I been trying to start this basic Arcade expression, well I thought it was basic. I want to display the difference between two date fields and if the number of days are less then 30 display the number of days in blue, if the number of days are over 30 days display the number of days in red. if there is no date in the "PI_DecisionDate1" then return "In Progress".
Here is what I have started, both fields are date fields
// Write a script to return a value to show in the pop-up.
// For example, get the average of 4 fields:
// Average($feature.SalesQ1, $feature.SalesQ2, $feature.SalesQ3, $feature.SalesQ4)
var startDate = Date($feature["Received_date"])
var endDate = Date($feature["PI_DecisionDate1"])
var age = DateDiff(endDate, startDate, 'days');
return "response time" + " " +age + " " + "Days";
//Less than
IF(age <= 30){
return age + "#2986cc"
}
//Greater than
IF (age >= 31){
return age + "D21C06"
}
// else return
// else{
// return "IN PROGRESS" "F9905D"
//}
result with the above, but I don't see the days populated when I click on the features on the map. Also, the formula doesn't see right from what I can tell.
Result Value
| Result | response time 43 Days |
| Type | String |