Arcade Text Color Dashboards List

293
1
Jump to solution
11-01-2023 12:13 PM
MelanieBass
New Contributor II

I have been struggling with what I thought was simple code for my list element in the dashboard. I just want the List element to show red when a particular date is shown: "December 29, 1899". I have reviewed other posts on this same thing and I can't get it to change at all. I have clicked from the globals and changed from this format for the $datapoint to the $datapoint["DateInspected"]. Nothing seems to work. I appreciate any insight. 

MelanieBass_0-1698865897905.png

 

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
KenBuja
MVP Esteemed Contributor

The value of DateInspected isn't just the date. It will contain the time and time zone information. If you just want the Date , you can format it using the Text function for your When statement.

var color = When(Text($datapoint.DateInspected, 'MMMM D, Y') =='December 29, 1899', '#FF0000', '#000000');
return {
  textColor: color,
  backgroundColor: '',
  separatorColor:'',
  selectionColor: '',
  selectionTextColor: '',
  // attributes: {
    // attribute1: '',
    // attribute2: ''
  // }
}

 This example will give you red text for the items that are on that date.

dash.png

View solution in original post

1 Reply
KenBuja
MVP Esteemed Contributor

The value of DateInspected isn't just the date. It will contain the time and time zone information. If you just want the Date , you can format it using the Text function for your When statement.

var color = When(Text($datapoint.DateInspected, 'MMMM D, Y') =='December 29, 1899', '#FF0000', '#000000');
return {
  textColor: color,
  backgroundColor: '',
  separatorColor:'',
  selectionColor: '',
  selectionTextColor: '',
  // attributes: {
    // attribute1: '',
    // attribute2: ''
  // }
}

 This example will give you red text for the items that are on that date.

dash.png