Dynamic symbology based on days passed

1286
5
Jump to solution
11-05-2019 09:40 AM
AGMAD
by
New Contributor II

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

5 Replies
DougBrowning
MVP Notable 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

DougBrowning
MVP Notable Contributor

I thought about using Arcade but for me I was using FeatureSet commands and they cannot be used.  But what Mark laid out it seems to allow.

0 Kudos
AGMAD
by
New Contributor II

Thanks for the response. It helped a ton!

0 Kudos
KylanNeff
New Contributor

I am pretty new at using arcade, and using the code example above basically worked for me, however,  I need to take it a step further if possible. The field I am calling (MowingFrequency) has two attributes: Mowed "1-3 times per week" and "Once every 7-10 days". I would like to create two sets of dynamic symbology in the same expression if possible. They seem to each work on their own, but how do I create an expression with them together? Would a When statement be applicable?

(7-10 days ago)

Var Mow1 = Date($feature["DateLastMowed"])  
if(DateDiff(Now(), Mow1, 'days')<=4){  
Var Status = "Green";  
}  
else if(DateDiff(Now(), Mow1, 'days')<=7){  
Var Status = "Yellow";  
}  
else if(DateDiff(Now(), Mow1, 'days')>8){  
Var Status = "Red"  

return Status  

(1-3 times per week)

Var Mow2 = Date($feature["DateLastMowed"])  
if(DateDiff(Now(), Mow2, 'days')<=1){  
Var Status = "Green";  
}  
else if(DateDiff(Today(), Mow2, 'days')<=2){  
Var Status = "Yellow";  
}  
else if(DateDiff(Today(), Mow2, 'days')>4){  
Var Status = "Red"  

return Status  

0 Kudos