Using comma separated list with choice filter

Is it possible to use a comma-separated list in the choice filter?

Here is an example from https://support.surveycto.com/hc/en-us/articles/360033730073-Guide-to-choice-filters-examples-to-copy-and-learn-from-part-3-

Hint: There is no function called “item-present” in ODK/Enketo, see XForm specification: ODK XForms Specification. But maybe, contains might do the job, or the selected() function with a space separated list.

1 Like

Thanks for your response! How would I implement the selected function with a space separated list? How would it be different than your standard selected function (i.e. selected(${org}, filter))?

Following up on this. How could I use the selected function to achieve what the item-present() is accomplishing above?

Would you mind to have a look at the documentation of the ODK functions, please, see esp. ODK XForms Specification and ODK XForms Specification.

Could you tell us please, which tool you are using, surveyCTO or ODK Collect or …?

2 Likes

I am using KoboToolbox/KoboCollect. I figured it out using the selected function. If we were using the example above, you’d first make the comma-separated string in the filter column a space-separated string (i.e. 1 2 3 rather than 1,2,3), then put the following function in the choice filter column of the XLS form: selected(filter, ${org})

Thanks so much for your help!

2 Likes

@barefootocean, :clap: :heart: :partying_face: