Dynamic filtering

Hi members could i get assisted how I can dynamically filter response in such a way that in a subsequent question, i get response that were not chosen from the previous question.
Example:
A.Which car brands do you know of?
1.toyota
2. mazda
3....nth

B. which cars do you like
(Assume one choses three out of possible 7 car brands available )

C. Which car brands don't you like
(I want options available for choosing in this question to be filtered in such a way that they are not among the 3 chosen from B above)

I hope I am clear enough and I can get support.

Great question @rigs!

The answer lies in the choice_filter column.

In your example, for question B, put the following in the choice_filter column:
selected(${know_carbrand}, name)

For question C, put the following in the choice_filter column:
not(selected(${like_carbrand}, name)) and selected(${know_carbrand}, name)

To be more clear, I've attached the example here:
example_dynamicfilter_cars.xlsx (16.9 KB)

Thanks!
Janna

PS. Let me know if that's what you were looking for, or if there was something else you were trying to do and I misunderstood!

1 Like

HI Janna, does the same rule all for a select one which is in a repeat

Thanks soooo much janna,

This is now working perfectly well for me.

Kind Regards;Reagan.+254 723-899 878/+254 739-278 843

1 Like

Hallo Janna,

You recently helped me with filtering on ODK and I am wondering if you
could assist me hack this.

I am working in xlsform and I want to display some of the options selected
in a select multiple question in another part of the survey, but when I use
jr:choice-name(${sponsor2}, '${sponsor2}') where sponsor2 refers to a
select_multiple question and then use a note to return ${calculate_1} where
calculate_1 is the jr: code line, it doesn't work and I get the below error.

FormLogicError: Could not evaluate: jr:choice-name(selected-at(
/model/instance[1]/tetiary_students_questionnaire/tuitionfee/sponsor2 , 0),
' /tetiary_students_questionnaire/tuitionfee/sponsor2 '), message: Function
"{http://openrosa.org/javarosa}choice-name" does not exist
See my attachment. I actually want the second last question to read: which
year did (pipe the selected sponsors here) beging funding your education?

Kind Regards;Reagan.+254 723-899 878/+254 739-278 843

two_2.xlsx (35 KB)

Hi @rigs,

Can I just clarify:
If they select "Charity organizations" for ${sponsor1}, do you want the second-last question to read:
"Which year did Charity organizations begin sponsoring your education?"

Thanks,
Janna

Hi Janna,

Exactly, that is what I want. And also remember it is a multi select so
they are at liberty to select more than one option.

Kind Regards;Reagan.+254 723-899 878/+254 739-278 843

A post was merged into an existing topic: Setting up dynamic select on XSL forms