Arcade Symbology using Expiration Date

907
1
11-12-2021 09:31 AM
Labels (3)
JessWeir
New Contributor

Hello! I am trying to create a map to track expiring projects. I am trying to get the symbols of the properties to change color when the projects expiration date enters a certain time frame. Like the symbol would turn/be red when its expiration date is less than year away(365 days) labeled as "Expiring within 1 Year". Yellow if the expiration date is within 3 years(1095 days) labeled as "Expiring within 3 Years". Grey if the project already expired labeled "Expired" and Green if its date is more than 3 years away labeled as "Active". Is it possible without ArcGIS Pro? If it is, what formula should I input into the Arcade or is there another way? Thank you!! 

 

 

0 Kudos
1 Reply
jcarlson
MVP Esteemed Contributor

Late response, but it's very similar to some other posts on here. Try something like this:

var ex = $feature['expiration_date']

var yearsLeft = DateDiff(ex, Now(), 'years')

if (yearsLeft < 0) {
    return 'Expired'
} else if(yearsLeft < 1){
    return 'Expiring within a year'
} else if (yearsLeft < 3){
    return 'Expiring within 3 years'
} else {
    return 'Active'
}

  Once you have your symbology classes from the expression, you will have to manually edit the symbol types for each category to get them to display as you wish.

Now, if your data doesn't happen to have at least 1 instance of each category, you won't be able to configure the symbol type for whichever ones are missing. That's where you would need Pro, at least until the web map viewer lets you configure "missing" symbol categories.

- Josh Carlson
Kendall County GIS