Link question to pick it's ID automatically

Hello all,
I have a challenge, In my form i have two questions school names and a school cods, wherewith i wanted to link school with its id, i mean when i am selecting school name the id automatically selected for that school, can you help me how to run this in ODK?
Thanks,
Samim

Hi @Samim

How many items do you have? I mean different schools?

Hi Grzesiek2010,
i have 60 different school names and 60 different school ids

Hi @Samim
Did you mean you to select the code or you want it to be selected automatically?
you can use choice filter and make it read only

Then it would be a readOnly select question so the answer will be empty. Using choice_filter is possibly but the question should be marked as required rather.
The second option would be to create a long if-else statement but since you have 60 items it won't be easy.

Hi Moteb,
i have 60 school names and for each school i have it's own id I wanted the id selected automatically since i am selecting school names how can i use choice filter can you give more clarification with some examples?
Thanks,
Samim

I don't think you need two questions here or choice_filters.

You can have a school select question where the name/value is the ID and the label is the school name. Then when a user selects the label and the ID is what is stored. Would that work, @Samim?

1 Like

Hi Grzesiek2010,
Could you please explain more or make it a little bit easy for me via some examples?
Thanks,
Samim

I think it doesn't make sense, because I need to put them in drop down boxes i couldn't do this due i need to link it with SQL database after data collected. if you have any thoughts more then this i would appreciated.
Thanks

If you do what I suggested with a select, then you can have a calculate question that uses jr:choice-name example that will also save the label.

1 Like

Hi aw Anokwa,
Could you explain more it think it's a good idea but still it's a little bit complicated for me i highly appreciated if you explain more here I am attaching school names and cods;
School Nname School Cods
Daykundi 200500001
Guzara 200500002
Karokh 200500059
Adraskan 200500060
when i am selecting Guzara school i wanted the ID 200500002 automatically selected.
Thanks

Try this schools.xlsx (9.7 KB)

1 Like

Thanks for sharing this but it's not working, please see the attached snapshot.
Thanks

I tried the form provided by @yanokwa and it's ok, probably your edited version is buggy. What is the tool you use? The screenshot is not from Enketo right?

I am using KoBo now it's working if i delete begin_repeat the only issue is with this i would appreciate if you support me for this, please see the screenshot

Could you attach the form?

sureF_1_M_database.xls (61.5 KB)

When I am deploying the form to KoBo this error popped up, since i am deleting the begin repeat from the form then no error is popped up

Please try just adding group name in row 21.

Hi again i tried this many times it doesn't' work