Select to view content in your preferred language

Arcade Expression with &&

441
3
11-08-2022 01:32 PM
by Anonymous User
Not applicable

Hello,

I am writing a very simple Arcade expression, but I am stuck. Basically, if the camp close date is empty and the post date is greater than 2 days, I want the background color to turn red.  I am doing this in the dashboard list.

I get the error unexpected token on the return. If I delete it, I get it on the textColor. 

__________________________________________________________________

var currentdate = now()
var postdate = Date($datapoint.firstpostda1);
var twodayslater = DateAdd(postdate, 2, 'days');

var pastduecolor = IFF((IsEmpty($datapoint.campclosedate)&&(currentdate > twodayslater), "#BE2528", "");

return {
textColor: '',
backgroundColor: pastduecolor,
separatorColor: '',
selectionColor: '',
selectionTextColor: '',
attributes: {
attribute1: pastduecolor

}

 

Thank you for your help. 

Annette

0 Kudos
3 Replies
KenBuja
MVP Esteemed Contributor

You appear to have an extra "(" in your IIF

var pastduecolor = IFF(IsEmpty($datapoint.campclosedate)&&(currentdate > twodayslater), "#BE2528", "");

statement

0 Kudos
by Anonymous User
Not applicable

Thank you. I deleted the "(" but I still get same errors.

 

0 Kudos
KenBuja
MVP Esteemed Contributor

Oops, one other error. The function is "IIF" not "IFF"

0 Kudos