Set up an optional choice filter

1531
4
12-28-2021 01:26 AM
Manu
by
Occasional Contributor

How can I set up an optional choice filter in Survey123? I have a survey with plant species where a plant family contains multiple genera which have multiple species. If a family is selected, the choices of genera should be limited to genera that occur within this family.

In case the family field is left empty, I want to include all possible genera in the genus-dropdown.

So far, I tried if statements, such as if(${family}=null, genus , selected(${family}, Family)) or alternatives, e.g. using string-length(${family})=0 as condition---however, with little success.

4 Replies
KristinThorpe1
Occasional Contributor

These articles may help you:

https://community.esri.com/t5/arcgis-survey123-blog/survey123-tricks-of-the-trade-choice-filters/ba-...

https://community.esri.com/t5/arcgis-survey123-blog/dynamic-choice-lists-using-search-appearance/ba-...

If you have a lot of family and genus options, it may be best to connect to an external CSV like the second article explains. Not sure if it will still generate a list of genus if the family field is left empty, though.

0 Kudos
JesseKalwij1
New Contributor III

BrettStokes has a workaround for this:

"A possible workaround would be to have two select_one questions for water body but only display one of these questions depending on whether a county has been selected or not. This is controlled using an expression in the Relevant column of your survey (eg string-length(${county})>0). "

https://community.esri.com/t5/arcgis-survey123-questions/survey-123-choice-filter-select-all-if-noth...

0 Kudos
JavierCMartínezPrieto
Occasional Contributor

hello
I don't know if it will help you but you can try filtering in the choice tab, which allows you to specify filtering on single or multiple choice questions, allowing only those options to be shown.

Javier C. Martinez Prieto
0 Kudos
JesseKalwij1
New Contributor III

I somehow did not manage to get those filters to work. The relevent option turned out to be the best work-around for me. 

0 Kudos