HOW TO
A dynamic date filter can be applied to a feature layer within a web map to filter the layer on specified dates. The filter can be used, for example, to show all the daily updates made to the layer, instead of manually updating the filter on the web map each day.
This article highlights the workflow to create a dynamic date filter for a feature layer using a custom Arcade expression.
Expects($feature, 'Date_Field_Name')
var time = -1
var units = 'days' //milliseconds, seconds, minutes, hours, days, months, years
var dateField = "Date_Field_Name"
var pastDate = DateAdd(Date(), time, units)
if($feature[dateField] > pastDate)
{
return 'Open'
}
Note: Change the first three variables to any desired value. The supported units are milliseconds, seconds, minutes, hours, days, months, and years. The dateField variable is the date field queried.
The map shows the custom dynamic date filter created for the feature layer.
Get help from ArcGIS experts
Download the Esri Support App