Dynamic symbology based on days passed

2573
4
Jump to solution
11-05-2019 09:40 AM
AGMAD
by
New Contributor III

I am trying to have symbology for a pesticide treatment automatically change after 6 days from the application. how would I go about doing this? I would like it to be visible to field workers in collector as well as AGOL.

0 Kudos
1 Solution

Accepted Solutions
MarkBockenhauer
Esri Regular Contributor

Tim,

You could try symbolizing the map using Arcade expression. (note: arcade expressions are not supported in Classic Collector).

Something like this.

In this example the creation date is used, but you could use last edited date, if you process is to just keep the attribute up to date for areas that have had treatments applied.

var time1 = Date($feature["created_date"])
if(DateDiff(Now(), time1, 'hours')<=1){
Var Status = "New";
}
else if(DateDiff(Today(), time1, 'days')>=0){
var Status = "Old";
}
else{
var Status = "Current";
}
return Status

Mark

View solution in original post

4 Replies
DougBrowning
MVP Esteemed Contributor

No since dynamic symbol would be too slow.  What about having the layers in the map twice with a filter?

0 Kudos
MarkBockenhauer
Esri Regular Contributor

Tim,

You could try symbolizing the map using Arcade expression. (note: arcade expressions are not supported in Classic Collector).

Something like this.

In this example the creation date is used, but you could use last edited date, if you process is to just keep the attribute up to date for areas that have had treatments applied.

var time1 = Date($feature["created_date"])
if(DateDiff(Now(), time1, 'hours')<=1){
Var Status = "New";
}
else if(DateDiff(Today(), time1, 'days')>=0){
var Status = "Old";
}
else{
var Status = "Current";
}
return Status

Mark

AGMAD
by
New Contributor III

Thanks for the response. It helped a ton!

0 Kudos
JonDolphin
New Contributor

This post was amazing solution for what I was banging my head for a while. Thank you Mark! And thanks AGMAD for raising this post.

0 Kudos