How to keep some choice(s) visible at all times with the aid of a cascading select function?

Hi,

under the field choice_filter, I used choice filter in order to filter 30 choices as per the district and keep two choices regardless of the selected district. for this purpose, I used two select statements. The form works well under the browser platform but In the case of the android platform, it doesn’t. it acts as there is no choice_filter. kindly find the XML form attached, please advise!
aTf7VYq4RWouKC6gndMpye (1).xlsx (16.7 KB)

Would you mind having a closer look at row 26 where you have used the following expression selected(${partner},option) under the choice_filter column. Then when looking back at the variable ${partner} in row 25 i observed that the same was a text variable.

Maybe this is the issue where you should have a closer look to fix it up.

Hi again,

Sorry for the late response. Can you please advise how I can fix it? I have tried to change the variable type to integer, but once I upload the XML form I got the attached error message.
integer problem

Then, I have tried to set the variable type as text, and I set the default as the letter “A” and put the value “A” under the column option. it worked using the browser platform, but it doesn’t do using the kobo app (android version)

Attache is the XML Form
aTf7VYq4RWouKC6gndMpye (7).xlsx|attachment
(16.7 KB)

It depends on what you wish to achieve. Kindly please make your requirement clear (i.e. why do you wish to use the expressions, what would you wish to achieve) so that the community could help you out.

Maybe if you put your issue and requirement in the forum the community could help you out how it’s done. Once you are aware on how it’s done you could design your own xlsform as required.

I want to be able to filter the choices of the variable Service_Partner as per the selected district. At the same time, I want the choices named 31 and 32 to appears regardless of the selected district.

Could you list out some dummy questions and some dummy choices with the requirement so that we could understand it better and help you solve your issue.

E.g.

Q1. This is question 1
Choices for Q1:
Response 1
Response 2
Response 3
Response 4
Response 5

Q2. This is question 2
Choices for Q2:
Response 1
Response 2
Response 3
Response 4
Response 5

So conditions required is …

OK, if the selected choice of Q1 is Response 1, I want Response 1 and Response 5 of Q2 to appear. In case the selected of Q1 is Response 2, I want Response 2 and Response 5 of Q2 to appear. I want Response 5 to appear regardless of the choose response of Q1

1 Like

Well this is very clear now. You could do the same as outlined in the image below:

In the survey tab of your xlsform:

In the choices tab of your xlsform:

Image 2

In the settings tab of your xlsform:

Image 3

Data entry screen as seen in Enketo: (when a condition is not met)

Data entry screen as seen in Enketo: (when a condition is met)

Reference xlsform:

Cascading Select.xlsx (13.3 KB)

2 Likes

Does it mean that I have to repeat the choice that I want it to be visible with all the other choices within the choices tab?

Yes! But do not forget to add allow_choice_duplicates in the settings tab!

1 Like

I think you can do it faster this way:
in the Choices sheet:
No need to repeat Responses 4 & 5, but rather in the Filter field of Responses 4 & 5, you put the concatenation of the names of all the Q1 responses (i.e. 12345, or 1_2_3_4_5)
in the survey sheet:
in the choice_filter of Q2 use: contains(filter,${Q1})

1 Like