Choice filter and using 'and'

Hi,

I am currently designing a form on ODK xls.
I want a choice filter on a multiple select question that if:

person 1 is selected location a and location other shows in the next question
person 2 selected location b and location other shows in the next question
person other is selected location a, b and other shows in the next question.
BUT
if person 1 and person other are selected only location a and other show in the next question not location b
if person 1 and person other are selected only location b and other show in the next question not location a

Thanks,
Jess

Could you please share a small form that demonstrates what you're aiming for and what you've tried so far? You're right that a choice filter with multiple conditions should help you there.

Your description is not exhaustive (e.g., what if persons 1 and 2 are both selected? Is it even possible, or is there a constraint preventing it in the first question?), but based on what you tell us, I would sum up the behaviour that you want as follows:

  • If person 1 is selected in the first question, location B does not appear in the second question.
  • If person 2 is selected in the first question, location A does not appear in the second question.

Is that correct? If yes, I found a way to do that by looking at this thread, which made me realise that the name column of the choices sheet can actually be used as a variable in a choice filter (I had never thought of that).

What makes your case different from the usual examples given for cascade selects is that your first question is a select_multiple instead of a select_one. But using the name values for locations A and B, we can achieve the two above bullet points with the two following filters, respectively:

  • not(selected(${person},'pers1') and name='locB')
  • not(selected(${person},'pers2') and name='locA')

So your complete choice filter would be combining those two as:

not(selected(${person},'pers1') and name='locB') and not(selected(${person},'pers2') and name='locA')

Here is example form where this is applied: Filtering_out_from_multiselect_value.xlsx (8.7 KB)

There might be a simpler or more elegant way to do it, but I don't know how.

1 Like

Thanks alot works correctly