1. What is the problem? Be very detailed.
Hello. I want to use multiple criteria for assembling a select_one_external list similar to the attached screenshot of csv form. The screenshot is part of a much bigger csv and is used in other sections of the form.
I have the following variables, and this is verified by using a note question.
calculate question ${code} with a value of TRN
calculate question ${code_generic} with a value of G
hidden question ${code_all} with a default value of All
then i tried various variations of the filter function
option = ${code} and ${code_generic} and ${code_all}
option = ${code} and option=${code_generic} and option={code_all}
option = concat(${code}, ', ', ${code_generic}, ', All')
I cannot assemble the list I wanted.
Any help would be awesome. Thanks 2. What app or server are you using and on what device and operating system? Include version numbers.
3. What you have you tried to fix the problem?
4. What steps can we take to reproduce the problem?
5. Anything else we should know or have? If you have a test form or screenshots or logs, attach below.
i have 3 variables with assigned value
${gear_code} -> TRN
${gear_code_generic} -> G
${gear_all) -> All
My problem is I have a select_one_external question. The choices in this question must rows whose values in the option column match any of the 3 variables. The result I want to see is something similar to:
The first 4 items match the All option
The next 4 items match the G option
The last 2 items match the TRN option
The help I need is how to construct the choice_filter using the 3 mentioned variables so that I can assemble a select_one similar to the example shown.
Here are some of my attempts.
option=${gear_code} and ${gear_code_generic} and ${gear_all} - don't work
option = ${gear_code} and option=${gear_code_generic} and option=${gear_all} - don't work
option = concat(${gear_code}, ', ', ${gear_code_generic}, ', ', ${gear_all}) - dont work
The ones below works, partially, but the form constructed is incomplete.
option = ${gear_code}
option = ${gear_code_generic}
option=${gear_all}
Hi. I replied to my own question and perhaps made my request clearer. Do you know how to write the choice_filter so that I can create the widget that I need?
I'll take some more time at the end of the days but I think your logical test can't work because because you ask "option" to match three different values with the AND operator as if you were asking for
x = 1 AND x = 2 AND x = 3
So you should try
option = ${gear_code} OR option = ${gear_code_generic} OR option = ${gear_all}
I tried your example using the attached xlsform that I sent and it does not return any items. I hope that what I need is supported by ODK because if it were not, the alternative that I can think of would mean a drastic increase in the number of rows in the external_choices csv file.
Thanks for looking at this. Please look at this simplified version of the xlsform. The values of the 3 variables, ${gear_code}, ${gear_code_generic}, and ${gear_all} are all assigned using a hidden question and set using the default column.
For the choice_filter, if i use option=${gear_code} it will work but the resulting form is incomplete. The same incomplete results also if I use option=${gear_code_generic} or if I use option=${gear_all}.
But when I use option = ${gear_code} OR option = ${gear_code_generic} OR option = ${gear_all} I get an empty result.
I'm sorry but I can't get it work. I do not understand why logical tests are giving a wrong lists with external data.
I can get it work using choices sheet : raffyM_filter_3.xlsx (9.3 KB)
But not with external choices : raffyM_filter_2.xlsx (10.9 KB)
Thanks @mathieubossaert. I feel that it is a requirement that the choices should be in an external_list so that when effort_spec is modified, we only need to update the itemsets.csv and not the form. I already have an alternative in mind, one that does not use inheritance. It will make the the number of rows belonging to effort_spec much longer though.
Do you think what I wanted to happen is unsupported in the current version of ODK?