Dependent dropdown

Dear users! good morning
can we use dependent drop-down in our XLS form?
i have a column in my Form named Province, its type is (select_one paktia_paktika), and then district column, now i want to depend districts on province mean (when i select Paktia province, district column should give me Paktia districts, and when i select Paktika province, district column in my form should give me districts of Paktika)
Note: Paktia and Paktika is Names of Provinces.
looking forward for solution
thanks in advance

Hello @Mansour ,

Yes you can . There are two solutions .

  1. If there are only two as you mentioned , In the choices sheet under list_name keep paktia_paktika and mention the two provinces . Then under list name keep paktia and mention all the districts similarly do it in the case of paktika . Now in the survey sheet after selecting one from select_one paktia_paktika give the relevant conditions accordingly .For example if he is selecting paktia then in the relevant column keep ${paktia_paktika}="paktia" and put the question as select_one paktia and similar way if he selects paktika.

  2. Create a seperate CSV with your own headers .For example list_name, province_name ,district_name , province . I am attaching a sample CSV and an Excel file for your better understanding, which i have created. Now if you want to select a province , select_one paktia_paktika , in the appearance add search("Name of CSV") . In the choices sheet add which columns should be searched . When it comes to dependency , you can opt many ways of selecting them . I have in this case opted 'contains' . Once see this link https://opendatakit.org/help/form-design/data-preloading/ and refer to the sample form i am attaching . I hope you get some answer with it . line_listingSample.csv (365 Bytes)
    Test.xlsx (8.9 KB)

I prefer second option to be better as it will reduce the size of the form.

Thanks and Regards,
SGSC .

3 Likes

An example for @SGSC first option you can find here
It explains how you do cascading. XLSForm also has some more on it. It's important that you have a column called "choice_filter" in your survey sheet.

2 Likes

Dear Mansour,
Contact me on waqar_571 via skype, i will guide you.

Regards
Waqar Ahmad

1 Like

thank you so much every one for your help and guidance, and
Mr.Waqar ahmad, i sent you friend request in skype, but it is not accepted yet, so if my request is not received, pleased add me on adil.heik
thanks so much

@Waqarahmadcro and @Mansour. I love that you are able to help each other, but if you can, please have these conversations out in public. In the same way that you’ve learned from the public resources that exist on the forum, others too benefit from your public conservation!

2 Likes

Thanks Yaw, got it.
Dear Mansour, find the attached file. CBSForm.xlsx (14.3 KB)

try the list like this that is in the attached file as an example. you can use the choice filter for this purpose.

Regards
Waqar Ahmad

1 Like

Thanks so much @Waqarahmadcro for your help and support, gotten, wish you happy and healthy life

1 Like

@yanokwa @SGSC @Waqarahmadcro

Thanks for the solution. However, I would like to add here one more issue.
If the list does not have a unique ID and we would want multiple options in the drop-down list.
e.g. I have a village ID and there are 2-5 schools in that village. I want the user will enter village ID and then the list of schools will come in the dropdown list to select.
I am enclosing my xls and csv files for your ready reference.
Please help how to achieve this.
Thanks, Naveen

search_and_select.xlsx (10.1 KB) list.csv (187 Bytes)

Hello @Naveen_Agarwal,

This should solve your issue. There are some minor changes in the XLSform. Please let me know if this helps.

Thanks and Regards,
SGSC

list.csv (187 Bytes) search_and_select.xlsx (9.7 KB)

Thanks @SGSC for your help.
However, all schools in the same village ID are not coming. e.g. for vid 515, there are 3 schools but comes only one. Please see again.
Thanks, Naveen