I need help in if else statement for my work
Am preparing a form which has an option field.
Example; Car Brand which car models and years
1st Field- Car brands (Toyota, Honda, Volkswagen etc); when the right one is selected, the next field shows the models. Say Toyota has been selected.
2nd Field- Camry, Corolla, Venza, Highlander etc. Say Camry has been selected
3rd Field - 1985, 1990, 1992, 2005, 2010, 2011, 2012 etc
Thanks so much for using the correct tags on the post. It helps us keep the forum well organized! Speaking of organization, the Development category is for posts about the process of building and modifying ODK tools. Form design questions should go into Support, so I'm moving this question there.
Now that we have that out of the way, I can finally answer your question! If you want to go from makes to models to trims, using cascading selects is your best bet.
Thanks so much but am using odk build
Cascading selects are a bit of an advanced feature so they aren't currently supported in Build. Maybe @issa can look at what it'd take to add.
Until then, you might want to try exporting your form to XLSForm and see if you can add cascades there.
Please can you help with the look as i could not figure it out.... Am using odk build to create the forms
You can first prepare all the items of your form in Build then export the form as a Excel file (XLSFORM).
To do this, in Build Menu you have File, View and Settings; select File, then click Export to XLSFORM then save the exported Excel file.
After that you can open the file in Excel (or OpenOffice/LibreOffice), adapt it and include your cascading following XLSFORM standards (see http://xlsform.org/). Once the form is finished in Excel, validate and transform it to XML, using http://opendatakit.org/xiframe/ or Nafundi's handy XLSFORM Offline app. Once you obtain a valid XML form, you can load and use it in ODK Collect.
Thanks so much. I get that but my main problem is with building the cascading. I've read through the form design help and cant really understand it, to talk of applying it to my current form. Thanks
Forget your current form for now.
Try the state/district/village form that is attached to http://xlsform.org/#cascade. See if you can get that working following Souirji's instructions.
If you get stuck at any step, respond to the thread and describe the steps you've taken, where in the process you are stuck, and how you've tried to get unstuck.
Here's an XLSFORM and its XML version doing what you want. I've put arbitrarily 3 different production years for each car model. It is modified from the form indicated by @yanokwa. I think he is right by asking you to try learning XLSFORM as you should if you want to use ODK successfully.
Hope this helps.
Thanks so much for your help. The format is a little different when I exported my ODKBIULD form to xls and i became confused. Attached is my form.Electric Poles_XLS.xlsx (28.8 KB)
I had a look at your form. first you are not following XLSFORM syntax rules and second I do not see any cascading in your form.
I have attached for you the (formatted and edited) XLSFORM syntax document in pdf format that I had prepared for myself from XLSFORM website. My advice would be to patiently go, step by step, through it and do all the exercises (hyperlinks to the exercises are active in the document).
If you do this, be sure that you shall be 'operational' in a matter of days. For very difficult issues (rare), you'll find or ask for answers in this forum, or elsewhere in the Internet.
XLSFORM tutorial_edhani.zip (847.1 KB)
Thanks so much. i quite appreciate you help.
Good news, folks! @issa is going to add cascading selects to the next release of Build.
You can track the progress at https://github.com/opendatakit/build/issues/162.
A post was split to a new topic: Seeing a summary of the data sent by enumerators before aggregation
I am really happy that @issa has added cascading in ODK Build Offline. However, it is far from clear how it works. The information given in the Information Pane is very limited.
Do you have a working sample Build project with the cascading?
It would be nice to have a sample Build project with all the widgets, as we have it in XLSFORM.
Like to know if I can have an option to let end user enter text if their selection is not on list?
I am working on enhancement on my current form by using cascading, but I found that some items may not available on selection (if) so counselor can input themselves.
Idea is I have 3 main questions ( 1.disturbance, 2. injury, 3. any friend / relatives dead) we are depending client how their response to their experience during the Crisis, some may want to talk about injury at beginning, some may talk about disturbance first.
I am thinking to use group selection on 3 main questions, then base on the 3 question cascade their corresponding sub-question, some question may pre-set answer, and counselor can input answer that not on list.
1a) Disturbance : No Food
1a) Disturbance : High Tide
1a) Disturbance : Other (manual enter)
1b) Emotion : Sad
1b) Emotion : Afraid
1b) Emotion : Worry
1b) Emotion : Other (manual enter)
1c) SUD Level (decimal, manual enter)
1d) How many days appear in the past 7 days : (Integer)
1e) Symptom : ASD
1e) Symptom : PD
1e) Symptom : AD
1e) Symptom : DD
1e) Symptom : PTSD
2a) Where is the injury : (manual enter)
2b) Emotion : (manual enter)
2c) SUD Level (decimal)
3a) Who : Father
3a) Who : Mother
3a) Who : Other (manual entry)
3b) Emotion : Sad
3b) Emotion : Frustrated
3b) Emotion : Other (manual entry)
3c) Do you recall in the pass 7 days? (decimal)
3d) Symptom : ASD
3d) Symptom : PTSD
Not sure if it can be done like above.
- add Other (value is 'other' for example) to the list of choices for your choicequestion of the Choose One widget.
Follow-up Question select 'other' (We are still in the Choose One widget!)
- add a text question widget with relevance : selected(/data/choicequestion, 'other')
Label your text question something like Please specify other ...
I wanted to add a good example given by @yanokwa in this forum (Colors.odkbuild) but I couldn't find where and the website won't let me upload a file with a .odkbuild extension.
I just found the link: https://forum.getodk.org/t/help-on-odk-build-how-can-i-create-other-on-multiple-choices/6533
Since I join the forum, I find interest in reading your post.please I need help concerning a form I build using Odk build.I am learning how to use the relevance column on Xls.when I saw your advice on building the form in build and then converting it to xls then apply the $ sign syntax to skip I jumped on it but it did not work.it is always given me error on that node when I try to validate.what do you think I should do?
I was thrilled by the addition by @issa of cascading, and other nice things, to Build Offline. Therefore I have tested it and made a little tutorial which is attached Build Offline-cascading select_Souirji.pdf (846.2 KB)
CascadingDemoGhani_default.xlsx (15.1 KB)
CascadingDemoGhani_default.xml (6.9 KB).
I would like to contribute the following remarks:
Cascading works very well in Build Offline. Many thanks @issa!
There's a little bug that produces a () under the column relevant which should not be there and prevents form validation, unless it is deleted;
I find that it would be more logical to call the 'Choose One' widget a 'Select One' widget to be consistent with XLSForm terminology. Otherwise, why not call 'Select Multiple' 'Choose Multiple'?
When there is no warning message, the worksheet warnings should not be created at all.
Thank you for your help.I am grateful