Select_one choice filter from another select_one

Hi,
I want to create a selection list (select_one) which should be filtered regarding the option selected in another selection list (select_one).
The first select_one contains the 7 characters of the second select_one. What I want is that for the second select_one only display those options matching the 7 characters of the first select_one.
The file can be downloaded using the following link: “removed link”

Hi @esmatullaharifi,

Welcome to the community! You could design your survey form with the cascading select question to get what you have tried for by following the support article here. As a backup you could also have a look at the post that has a simple workaround that should help you understand the concept of cascading select question:

But looking at your xlsform, i see there are more then 800 choices which should affect your data entry performance. Thus a solution for this could be designing a form combining cascading select question type with select_one_from_file question type as outlined in the image below:

In the survey tab of your xlsform:

In the choices tab of your xlsform:
Image 2

CSV file:
Image 3

Data entry screen as seen in Enketo:

Reference xlsform:
select_one_from_file.xlsx (15.8 KB)

Reference csv file:
CDC_Code.csv (35.5 KB)

Please feel free to have a look at our support article Select one or many from external file question type to learn more on select_one_from_file question type.

Have a great day!

2 Likes

Hello @esmatullaharifi ,
As your token is part of the name of the second choice, and the names have a structured format, you could also use a substring function (see https://getodk.github.io/xforms-spec/#fn:substr) together with a choice_filter.
FilterSubstr01.xlsx (24.2 KB)
It works after some time to load first.
I guess the solution of @Kal_Lam with an explicit cascade column and the pull data will be more performant.

2 Likes

Thank you so much from both of you @Kal_Lam and @wroos.

1 Like

This is gold, I was just looking to do this cascading with external csv.
In my case, I needed a 3rd list cascading from the 2nd one.


It’s not working with Enketo, but it works great with ODK Collect v1.27.2.
I have a list of 8,500+ villages in 150 districts and it loads pretty fast.

Thanks!

2 Likes

Hi @pasteurlaos,

Glad that it was a help for you!

Have a great day!

Hi @pasteurlaos
Having reviewed this even further. You can actually achieve this without mentioning select_one_from_file by using the following coding approach which uses the search functionality.
Survey Sheet

Choices sheet

With the above, you could actually achieve to have all your data in one csv and just call the one you need using the search() command.

Stephane

1 Like

Thanks… So apt…

1 Like

Hi, can u show the snapshot of csv file of both the questions?

Hi @vicks88
I believe the following post will address your concerns

Stephane

1 Like

sure.I wil chk this out.
Many thanks for ur concern & helping out sir

1 Like