Arcade Code IIF Statement for List Item showing Status Change

598
3
07-17-2020 12:38 AM
deleted-user-sNUdtFrn2yEY
New Contributor III

Hello, this is my first attempt at trying to use Arcade in Operations Dashboard.

I want to change the List Item background color based on the Survey status. I'm having difficulty trying to get this Arcade code to work. See code sample and screen shots.

Code sample:

// Status of Survey entry
var color = IIF($datapoint.status == open, '#FFBEBE', '');
var color = IIF(datapoint.status == closed, '#D3FFBE','');
var color = IIF(datapoint.status == inprocess, '#BEE8FF','');
return {
textColor: '',
backgroundColor: 'color',
separatorColor:'',
selectionColor: '',
selectionTextColor: '',
// attributes: {
// attribute1: '',
// attribute2: ''
// }
}

Thanks in advance for any assistance you can provide me with. I'd like to try and change the Background color for Status - (open, closed and inprocess).

Best regards,

Colleen Madigan Schelde

Senior GIS Specialist

Radiuselnet

comas@radiuselnet.dk

+45 9955 6902

0 Kudos
3 Replies
deleted-user-sNUdtFrn2yEY
New Contributor III
0 Kudos
XanderBakker
Esri Esteemed Contributor

Hi Colleen Madigan Schelde ,

On lines 2, 3 and 4 of the original code. when you want to validate if the status is open, closed or in process, you will have to enclose those values in quotes. The other change required is that you will want to not use quotes when you access the values assigned to the color variable (see line 13). In the example below I have changed the first part of the code to make it a little bit more readable.

// Status of Survey entry
var color = '';
if ($datapoint.status == 'open') {
    color = '#FFBEBE';
} else if ($datapoint.status == 'closed') {
    color = '#D3FFBE';
} else if ($datapoint.status == 'inprocess') {
    color = '#BEE8FF';
}

return {
    textColor: '',
    backgroundColor: color,
    separatorColor:'',
    selectionColor: '',
    selectionTextColor: '',
    // attributes: {
    // attribute1: '',
    // attribute2: ''
    // }
}
deleted-user-sNUdtFrn2yEY
New Contributor III

Xander -

Thanks so much for your quick response and help with my question! This is so awesome and very much appreciated. Have a great day! It works great!! :)

Best regards,

Colleen Madigan Schelde

Radiuselnet

0 Kudos