Exclude a value from a multiple select in ODK xlsform

851 views Asked by At

I'm trying to exclude a value from a multiple select in xlsform. If we use the analogy of farming imagine:

I have a question asking what crops a farmer grows. The available multi select choices from the list name "crops" are:

Apples
Oranges
Bananas
Pears

The respondent chooses the first three. A later question asks which crops the farmer grows together (intercropped i.e. growing two furits in the same field / space). I use a choice_filter "selected(${crops},crops)" on the list name inter_crops and the resulting multiselect shows:

Apples
Oranges
Bananas

All good so far.

Then I would like to know which crops are intercropped with which. So I have subsequent questions for each crop grown such as:

Which crops are inter-cropped with... bananas? (etc etc)

I can use the same choice_filter here but that would mean the multiselect would still have bananas as an option. It would not make sense to respond to the above question with "bananas" (i.e. bananas are intercropped with bananas).

So how can I exclude bananas as an option when asking about bananas, exclude apples when asking about apples etc without having to have specific lists for each question?

Update

Answered my own question. I just needed to add an "and not" statement to the choice_filter. So now it reads:

selected(${crops},crops) and not (crops='bananas')

0

There are 0 answers