We have a string field in survey123 titled Activity Notes. If the field is empty, we do not want anything displayed. I cannot get it to work. Error is Unable to execute Arcade script. I am creating this in the list widget. Thank you for any help. Annette
returnstring = $datapoint["activity_notes"]
if (IsEmpty(returnstring)) {
return "";
} else {
return returnstring;
}
Solved! Go to Solution.
Hi Annette!
In a Dashboard's Advanced Formatting, the returned object always needs to be a dict with attributes.
What you can do is put the returnstring into the output attributes object. Items in this can be referenced using the format {expression/attributename}. Like this:
return {
attributes: {
returnstring: $datapoint["activity_notes"]
}
}
And in your list item template, put {expression/returnstring} in there, and the attribute will show up.
As an added bonus, when that expression is on its own line in your list item template, the line will not even display if the attribute is empty.
Hi Annette!
In a Dashboard's Advanced Formatting, the returned object always needs to be a dict with attributes.
What you can do is put the returnstring into the output attributes object. Items in this can be referenced using the format {expression/attributename}. Like this:
return {
attributes: {
returnstring: $datapoint["activity_notes"]
}
}
And in your list item template, put {expression/returnstring} in there, and the attribute will show up.
As an added bonus, when that expression is on its own line in your list item template, the line will not even display if the attribute is empty.