Choice sheet conditional options

I think we’ve figured out how to conditionally filter a list from the choices sheet. I’m posting this both to check whether this is a viable solution (in case I’m overlooking something) and to share it in case it’s helpful to others in the community.

In our scenario, we needed to conditionally show the “Death certificate is only source” option in the source of death information list—but only if the preceding question, “Is the death certificate available?”, is answered “yes”.

Choices sheet:

list_name name label::en choice_filter
yes_no yes Yes
yes_no no No
source household_member Household member TRUE
source different_person Other person TRUE
source health_records Health record(s) TRUE
source other Other (specify) TRUE
source death_certificate_only Death certificate is only source dc_applicable

Survey sheet:

type name label::en calculation choice_filter
select_one yes_no is_death_certificate_available Is the death certificate available?
calculate dc_applicable ${is_death_certificate_available} = ‘yes’
select_multiple source source Other sources of death information: (Please select all that apply) choice_filter = ‘TRUE’ or (${dc_applicable} = ‘true’ and choice_filter = ‘dc_applicable’)

Please let me know if this approach is already documented somewhere. I might have missed it :sweat_smile:

This may be related to the following thread:

Just wanted to confirm that, yes, I think the choice_filter column on the survey sheet is the proper way to filter select choices per the ODK docs. There are probably several valid ways to structure your column data on the choices sheet to group/partition the choices. But, in every case, you will ultimately just need to use the choice_filter expression on the survey sheet to filter those choices.

1 Like