I have a survey from Survey123 with a field that allows users to select multiple answers. This data is stored in the feature class in the format option1,option2,option4.
I would like this to display in the dashboard in the format Option1, Option2, Option4.
I tried using the find function (see below) however it only finds the first selection in the list. In the below example there it would not find option2 and return the "" string.
iif(Find("option2",$datapoint["example_field_name"])==0,"Option 2","")
Solved! Go to Solution.
Haven't worked with Arcade in Dashboards yet, but in other applications it would work like this:
var options = Split($datapoint["example_field_name"], ",")
var formatted_options = []
var formats = [
["option1", "Option 1"],
["option2", "Option 2"],
["option3", "blah"],
["option4", "blub"]
]
for(var f in formats) {
if(Includes(options, formats[f][0])) {
Push(formatted_options, formats[f][1])
}
}
return Concatenate(formatted_options, ", ")
Can you explain more? Where are you trying to put the Arcade? In a data expression, formatting expression or somewhere else?
Have you tried calculating a new field and displaying that?
Screenshots always recommended.
Haven't worked with Arcade in Dashboards yet, but in other applications it would work like this:
var options = Split($datapoint["example_field_name"], ",")
var formatted_options = []
var formats = [
["option1", "Option 1"],
["option2", "Option 2"],
["option3", "blah"],
["option4", "blub"]
]
for(var f in formats) {
if(Includes(options, formats[f][0])) {
Push(formatted_options, formats[f][1])
}
}
return Concatenate(formatted_options, ", ")
This worked beautifully. Thank you for your help!