Using the answers to a multiple-select question to filter the choices of another question

972
2
Jump to solution
08-20-2021 03:52 PM
AlfredBaldenweck
Occasional Contributor III

I'm looking at making a cascading choice list in which the question to filter the choices by is multi-select.

For example (pivoted for readability):

FruitRelevant choices
AppleRed Delicious, Yellow Delicious
GrapeMerlot, Concord
BlueberryIvanhoe, Patriot, Violetta

 

If I were to select both "Apple" and "Grape", I would want "Red Delicious", "Yellow Delicious", "Merlot", and "Concord" to all show up as options in the next question.

I thought I had seen somewhere that it was possible by using selected() in the choice filter, but that appears to require specific choices be named.

Is this possible?

Thanks!

0 Kudos
1 Solution

Accepted Solutions
DougBrowning
MVP Notable Contributor

I tried using selected-at and it worked.  You would need to write out enough select-at to cover the max number of choices.  See attached but your choice filter would be.

selected(selected-at(${fruit}, 0), fruit) or selected(selected-at(${fruit}, 1), fruit) or selected(selected-at(${fruit}, 2), fruit)

Double select multiple.gif

That said I think the data you got from this would be really hard to analyze later.  You would have so many long strings of comma separated values with all the fruits and types intermixed.  Any time I have to use a select multiple I pull them back apart into rows later in script.  Not sure the use case here.  Also select multiple cannot have spaces in the values.

Hope that helps.

View solution in original post

0 Kudos
2 Replies
DougBrowning
MVP Notable Contributor

I tried using selected-at and it worked.  You would need to write out enough select-at to cover the max number of choices.  See attached but your choice filter would be.

selected(selected-at(${fruit}, 0), fruit) or selected(selected-at(${fruit}, 1), fruit) or selected(selected-at(${fruit}, 2), fruit)

Double select multiple.gif

That said I think the data you got from this would be really hard to analyze later.  You would have so many long strings of comma separated values with all the fruits and types intermixed.  Any time I have to use a select multiple I pull them back apart into rows later in script.  Not sure the use case here.  Also select multiple cannot have spaces in the values.

Hope that helps.

0 Kudos
AlfredBaldenweck
Occasional Contributor III

Thanks for trying that out.

The main thing is I'm trying to make as little work on the end-user's end if I can make the computer do all the work later. In this case, I would have as many as 500 "fruit" to choose from, each of which has 1-5 "types".

While I have it set up as a repeat, I'd like to  not have the user answer 500 repeats if they could answer like, five of them (per genus, for the sake of the metaphor).

I was already going to split the last multi-select after survey submission (Thank you again JohannesLindner); am spitballing my way through making it work for two multiselects today, which will hopefully involve some data-validation.

Thanks again!

 

Edit 8/27/2021:

Apparently selected() does work fine as a choice filter for multi-selects. 
Syntax is selected(${Question}, [Filter range]).

Selected-at() works well, but it gets wordy. I've ended up using it to validate whether a question has been answered at all before popping up with another question to answer

Survey123 Tricks of the Trade: Choice Filters - Esri Community

0 Kudos