Hi all,
I'm trying to use Arcade for this first time on a hosted feature layer in AGOL.
The data for this layer is collected by a field crew using Collector for ArcGIS. The last_edit_date field is automatically populated for each feature during data collection.
In AGOL i want to display any features where the last edit date has exceeded a year from the current date to show that an inspection is now due on that feature.
As I've said, I'm new to Arcade but tried this expression but it doesn't seem to work correctly:
var inspDate = $feature["last_edited_date"];
if (DateAdd(inspDate, 1, year) < Today()) {
return 'Inspection overdue';
}
else {
return 'OK';
}
Any pointers on where I am going wrong or even if it is possible to do what I am trying to do?
Thanks
Solved! Go to Solution.
When using any of the Date functions, the units must be in quotes. Otherwise, it's interpreted as a variable. Try this
var inspDate = $feature["last_edited_date"];
if (DateAdd(inspDate, 1, "year") < Today()) {
return 'Inspection overdue';
}
else {
return 'OK';
}
When using any of the Date functions, the units must be in quotes. Otherwise, it's interpreted as a variable. Try this
var inspDate = $feature["last_edited_date"];
if (DateAdd(inspDate, 1, "year") < Today()) {
return 'Inspection overdue';
}
else {
return 'OK';
}
I realize this is an old post but i was trying to do something similar to this but I was trying to symbolize layers differently for records that were created a week or more ago; using creatdt field created from applying editor tracking. I attempted to modify above script and inserted "week" where "year" is but it is still symbolizing features that were created today. Am i missing something or is this script not meant for what i'm trying to do.
Thank you Ken. This was exactly what the issue was!