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.
Solved! Go to Solution.
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.
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.
I had a similar issue that I've been trying solve for weeks with no luck. This worked perfectly!
Thank you!