Select to view content in your preferred language

Arcade expression for how many days left until target date field

649
2
Jump to solution
12-22-2022 03:26 AM
Labels (1)
e_cat
by
New Contributor III

I'm looking for an Arcade expression to symbolise a feature layer in a web map based how many days left there is until my target date field (Target_Dat), compared to Today's date, so hopefully the symbology will keep changing live. 

I'm looking for if the target date is before today's date, then it will be "overdue". If it's within 30 days, it will be "nearly due", and anything in more than 30 days time will be "on schedule"

Would appreciate any help please

0 Kudos
1 Solution

Accepted Solutions
KenBuja
MVP Esteemed Contributor

This will return the outputs

var days = DateDiff($feature.Target_Dat, Today(), 'days');
return when (days > 30, "on schedule",
             days >= 0, "nearly due",
             "overdue");

View solution in original post

2 Replies
KenBuja
MVP Esteemed Contributor

This will return the outputs

var days = DateDiff($feature.Target_Dat, Today(), 'days');
return when (days > 30, "on schedule",
             days >= 0, "nearly due",
             "overdue");
e_cat
by
New Contributor III

Amazing, thank you so much! I kept getting an error with my code so I think I need to do a lot more practice with it

0 Kudos