I have a hosted feature layer that updates every time there is data submitted from a field worker with the date. I have created a view layer and a Web App Builder's Weekly report. I would like to build an Arcade expression based on ISOWeek or ISOWeekday to return the count of the features for each week. The purpose is to refresh the feature counts every week on Monday. I referenced the following link: ArcGIS Online Community Post and have created a sample code:
if ( ISOWeek($feature.yourDateField) == ISOWeek(Now()) ) {
return 'Count';
}
However, it seems like it's not returning the feature count for each week. It seems like I'm misunderstanding something, and I need help.
Unfortunately, the widget (Weekly Counts) on Web App Builder is only showing reports for last 7 days. Which means, if the end user sees the report on Thursday, the number of feature layer that the user receives includes the number from Thursday through Friday.
I would like to see the number of the feature count that is refreshing every Monday (Showing number of features collected based on Date field *Contacted Date) starting from Monday and ending on Sunday - every week.
Your attempt is not working because:
You should use the Count() function with a filter for the current week, but the way to do that depends on where you're trying to display this information. Is this for a dashboard indicator, or?
Thanks for the response. I am actually trying to display the information in a WebApp Builder Infographic. The ultimate goal is to move this away from WebApp Builder to Experience Builder. But for now, that is where I am trying to display this information.
I don't know of a way to use Arcade in the WAB infographic widget at all. I don't think it's possible. To my knowledge, this isn't even currently possible in ExB. It could be done in Dashboards, though.
Thanks. That is kind of what I was thinking. Do you think that there is a way to create a filter on the data itself or on a feature layer view to only show the data entries for "This Week"?
I don't think so. You're limited to the filters available on the service's Visualization tab, which would be "within the last 1 weeks", not "since Monday", so that doesn't solve your problem.
An alternative could be to create a hosted table to hold this value then use a scheduled Python script to write the appropriate count to the table, pulling that into your indicator. Wouldn't be too difficult but a lot of moving parts for a simple indicator.
ArcGIS Dashboards is the easiest way.