Select to view content in your preferred language

Arcade Code Question

821
1
07-22-2020 02:43 AM
deleted-user-sNUdtFrn2yEY
Deactivated User

Hello - I thought I could try and make this work based on Xander's help with my first Arcade code question in Operations Dashboard Beta.

I'm trying to change the background color on a List Element based on Total NEJ >= 1. (NEJ = NO)

Total NEJ is set as hidden and is a calculation coming from a survey built in Survey123 Connect. The survey asks multiple questions where if each question has a NEJ answer then Total NEJ equals the sum of all the NEJ answers for all the questions in the survey.

My Arcade Code

// Total NEJ greater than or equal to One - Change Color Background

var color = '';

if ($datapoint["total_nej"] >='1') {

    color = '#FFBEBE';

 

return {

  textColor: '',

  backgroundColor: color,

  separatorColor:'',

  selectionColor: '',

  selectionTextColor: '',

  // attributes: {

    // attribute1: '',

    // attribute2: ''

  // }

}

I noticed the $datapoint["total_nej"] does not look like $datapoint.xxxxxx that some of the other Arcade code samples look like. Can you build an Arcade statement off a calculated field?

Thanks in advance for any assistance you can provide and I look forward to hearing back from Esri. Have a great day!

Best regards,

Colleen Madigan Schelde

Radiuselnet

comas@radiuselnet.dk

+45 9955 6902

0 Kudos
1 Reply
deleted-user-sNUdtFrn2yEY
Deactivated User

OK, I figured it out!! I was missing one little item - the "}"

Here is the code:

// Total NEJ greater than or equal to One - Change Color Background
var color = '';
if ($datapoint["total_nej"] >= '1') {
color = '#FFBEBE';
}
return {
textColor: '',
backgroundColor: color,
separatorColor:'',
selectionColor: '',
selectionTextColor: '',
// attributes: {
// attribute1: '',
// attribute2: ''
// }
}

Have a great day!!

Best regards,

Colleen

0 Kudos