Dynamic choices

What is the problem? Please be detailed.
I want to create dynamic choices based on the answers obtained earlier.

Q1. Total number of males in the household: (for eg: 1 )
Total number of females in the household: (For eg: 1)
Total number of Third-Gender in the household: 0

Now based on the number of individuals in each of the three categories. I want the option for the next question(Q2) to change.

That is:

   Q2.Who is involved in decision making process?
  • As per the So the choices should just show males and females as options.

However, in case of another example for the same question set

Q1. Total number of males in the household: (for eg: 0 )
Total number of females in the household: (For eg: 1)
Total number of Third-Gender in the household: for eg: 1

Now based on the number of individuals in each of the three categories. I want the option for the next question(Q2) to change.

That is:

   Q2.Who is involved in decision making process?
  • As per the So the choices should just show females and third gender and not show males.

Thanks

What ODK tool and version are you using? And on what device and operating system version?
I am using xlsform to draft the questions on mac os 10.13 high sierra.

What steps can we take to reproduce the problem?

What you have you tried to fix the problem?

Anything else we should know or have? If you have a test form or screenshots or logs, attach here.

Hi @Saral_Karki

choice_filter is the answer for your problem. Please take a look at the sample form I prepared for you:
choiceFilter.xls (9.5 KB)
choiceFilter.xml (4.5 KB)

1 Like

And https://docs.opendatakit.org/form-logic/#filtering-options-in-select-questions has examples and a little video explaining choice_filter

1 Like

Hi Yaw,

Thank you. That did indeed help me understand the choice filter.

Hello @Grzesiek2010

Thank you for your help. Appreciate it. However, the solution provided does not quiet work as it should. Have attached screenshot to explain better-

So, my issue is when any of the value for males, females or third gender is 0 - the options should still show. Right now if any of the value is set to 0 the options do not show.

For eg:

In the 1.png, the total number of males is 1, females is 1 and Third Gender is 0. So the options available for Q2. Who is involved in decision process - should be :
Female and Male
However, no options is shown.

If you see 2.png, the Q2 is correct.

However, again in 3.png- the total males is 0 , so the options shown in Q2. Who is involved in decision process - should be :

Female and third gender.

However, no options is shown.

Thank you again for helping me out. More help would be appreciated. Thanks :slight_smile:

help.pdf (115.2 KB)

(P.S- Am a new user and the forum only allowed me to upload one pic so I had to put the three pic in one file)

Thank you for your help. Appreciate it. However, the solution provided does not quiet work as it should. Have attached screenshot to explain better

I'm pretty sure my solution works well and I understand your problem. Don't know why it doesn't work in Enketo but in ODK Collect it does.

If you use Enketo please contact them to find out what's wrong.

1 Like

Thank you. I will contact Enketo regrading this.