I have a select_multiple that has a list of birds to choose from. When I choose 'Other', it opens a following question using the relevant field. This setup follows: https://community.esri.com/groups/survey123/blog/2017/12/11/making-other-work-harder-in-survey123-re..., but is adapted for a select_multiple. I then have a third field that is hidden that takes the answers from the previous fields and concatenates them. The concatenation is roughly as follows:
if(selected(${field_one}, 'Other'), if(count-selected(${field_one}) > 1, concat(${field_one}, ', ', ${field_two}, ${field_two}), ${field_one}).
It should read:
if (other is selected in the first field) then
if (there is more then the other selected in the first field) then
concatenate both fields and return
else
just return second field
else
just return first field
The issue is that if both fields are concatenated, the selection of other from the first field will still be listed within the string. I can remove it during the concatenation by removing the last 6 characters of the substring, but that requires it to be selected last from field one when the user is filling out the survey.
Is there anyway to force the order the answers are selected or another way to concatenate the results?
Thanks
Hi Colin,
There are a couple of methods of doing this. If your choice list is small, you could test each choice to see if it is selected and place it in the concat() function:
concat(if(selected(${q},'choice1'),'choice1,',''), if(selected(${q},'choice2'),'choice2,',''), ...)
If the list is too long, an alternative might be to use a custom JS function to remove the 'other' value from the text. This is beta functionality documented in the Early Adopter Community.
Thank you James. It is a list of habitats that currently sits at about 15 options, so doable by concatenation but prone to error. I don't think I will venture into the early adopter community unless I can continue to explore with my trial account.
I think I'll just export it in a report with the "other" included within some special characters and just remove it using a macro later.