I need help writing an expression to use in ArcGIS online in a hosted feature service for symbolizing forest practice application data.
This is what I need it to display:
If (The effective date plus 6 years)= date before today, Label & Symbol: "6 year moratorium has ended"
If (The effective date plus 6 years)= date after today, Label & Symbol: "Active Permit"
This is the dataset I am using:
I started out writing this, but it isn't correct.
var startDate = $feature["EFFECTIVE_DT"];
var sixyears = DateAdd(startDate,6, 'years')
return sixyears;
Solved! Go to Solution.
You're almost there. The last step is to determine whether the date you calculated is before or after today:
var startDate = $feature["EFFECTIVE_DT"];
var sixyears = DateAdd(startDate,6, 'years')
return sixyears < Today()
This will return true for permits that passed the moratorium date, false for active permits.
Then you can change the legend labels:
And that's it.
Maybe try something like this before your DateAdd line? Maybe it's not treating the date as you expect it to be..
var recordDate = Date($feature.dateField)
You're almost there. The last step is to determine whether the date you calculated is before or after today:
var startDate = $feature["EFFECTIVE_DT"];
var sixyears = DateAdd(startDate,6, 'years')
return sixyears < Today()
This will return true for permits that passed the moratorium date, false for active permits.
Then you can change the legend labels:
And that's it.
Thank you so much, I really appreciate the help!