Exclude elements of a list in a repeat (avoid asking the questions if the choice in the list is "other")

Hi all

In my form I have 2 questions. Q1 is a list, Q2 is within a repeat, meaning that for each elements ticked in Q1, Q2 will appear.
Q1 (select multiple): which crops do you grow (Answers are: wheat, rice, corn, vegetable, other) ?

Q2 (decimal) What is the yield of ${Q1}

Q2 can then be the following :

  • List item

  • "What is the yield of corn",

  • What is the yield of wheat",

  • "What is the yield of rice ",

  • "What is the yield of other "

How can I prevent the form to show "What is the yield of other"?

3. What have you tried to fix the issue?
I tried to put not(selected(${q1},"other")) in the relevant column but whenever "other" is ticked (in addition or not to rice/corn/wheat), no questions are be displayed

I also tried if(selected(${q1},"other"), "0", count-selected(${q1_1_1})), in "repeat count" column did not work either. Same reason

Finally I tried to put not(selected(${q1},"other")) in the choice_filter column with no effects.

How can I display the Q2 for the corn, the rice and the wheat, using a repeat, but not for "other" ?

Thank you

Hi @pol-91

Welcome to the ODK forum. We're glad you're here. When you get a chance, please introduce yourself on this forum thread. I'd also encourage you to add a picture as your avatar because it helps build community!

What about something like this:
TestForm.xlsx (6.8 KB)
Does that work for you?

1 Like


Thank you it works!

Why do you add a "position" rule after the "!=" ?


It's not directly related to the problem you described and wanted to solve (excluding that other element) it's rather a workaround to make sure the number of displayed groups is correct. In ODK Collect there is no mechanism of auto-deleting repeat groups. So if you have a form where the number of repeats relay on the answer passed in one of the previous questions (like in your case the number of selected options in select_multiple question) if during filling a form you change your mind and navigate back to that question and change the answer so that the expected number of repeats is smaller (for example you unselect one of the choices) then those additional groups will still be displayed. With this small trick, theoretically, they exist but are ignored and not displayed.

It's also described in the documentation so you can read it https://docs.getodk.org/form-repeats/#setting-a-max-limit-on-repetitions

1 Like