Using Dashboard list w/ arcade expression for date values

306
2
08-11-2021 08:42 AM
Labels (1)
neomapper
New Contributor

How do I setup an arcade expression that compares the Scheduled_Site_Visit field "8/11/2021, 1:00:00 PM" to todays date and if it equals todays date which is 8/11/2021 then tell the list for item 8/11/2021 to change the background color to red (hex code: #F3DED7) ?

 

 

 

 

 

var today_date = Today();
var color = IIF($datapoint.Schd_Site_Visit == today_date, '#F3DED7','');

return {
  textColor: '',
  backgroundColor: color,
  separatorColor:'',
  selectionColor: '',
  selectionTextColor: '',
  // attributes: {
    // attribute1: '',
    // attribute2: ''
  // }
}

 

 

 

 

 

neomapper_0-1628695994534.png

 

2 Replies
DavidPike
MVP Frequent Contributor

probably use DateDiff as a comparator of the timestamps  - as per Solved: Arcade expression for date equals today or earlier - Esri Community

JansenLyons
Occasional Contributor II

Hi @DavidPike & @neomapper , I've got this very thing to work before as well using DateDiff. I've found this article very useful and I am not sure I saw it linked to David's post. Hope it helps, great question neo!

https://developers.arcgis.com/arcade/function-reference/date_functions/ 

Cheers,

 

Jansen Lyons - Records and GIS Section - Public Works - City of Rio Rancho, NM