Revelant if n numbers of questions are yes

Hi
I'm not an expert on ODK. This is only the second survey that I'm writing. Although I have read many manuals and forums looking for the answer to my question and I couldn't find anything.

Is it possible to create a condition to make a question appear only if "n" number of questions of a previous section are answered in a certain way?
For example, I'm writing a survey for farmers, so I have a list of 10 practices. I have written each practice as a question like:
1.- Do you manage your farm with ....?
2..Do you practice -....?
...
10 ...

Each question is a "select_one" type, with options: 1 yes and 0 no
Is it possible to create a restriction so that only those who make at least 6 practices (answer yes to at least 6 of the 10 questions) move on to the next section?

Thanks in advance to everyone

Welcome to the ODK forum, @ricardovr22! 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!

If your questions will have answers of either 0 or 1 (as the choice name) then this should be simple to implement. You can put a constraint on the next section that looks something like:
(${q1}+${q2}+${q3}+${q4}+${q5}+${q6}+${q7}+${q8}+${q9}+${q10})>5

check_yes_count_example.xlsx (9.6 KB)

Note that in this implementation, you must answer all the questions used in the relevant before it will correctly calculate. And all the possible answers must be 0 or 1. A text answer will not be a number and will mess up the addition. A blank answer will not be a number and will mess up the addition. If you need more flexibility you can explore empty values in math, and if statements to evaluate certain answers to either yes or no using accompanying calculate type questions.

1 Like

Thanks for the answer
I didn't know that ODK allows doing math operations using questions types that are not declared as integer or decimals. I thought that ODK assumes that the answer was a string if the question was declare as select_one. That really useful to know

In the end, I implement a different solution. Since all the questions were yes/no, I combine all the questions in a single select_multiple question type (Something like "Select all the statements that are true)," and then I used the count-selected operator (count-selected${new_question}>5)

1 Like