Select All options in multiselect


I have a multi-select question that I am using to create a roster and for my purpose, all options must be selected. (MS options are filtered based on previously provided information.)

In order to ensure that enumerators do this, I would like to insert a validation condition. Is there a way to say that the length of the array created from options selected must be equal to the length of the existing options? Or another option?


Hi @nehapaliwal

I have an example. I can share you it if you want.

Basically that I do it in the validation is in the multiple categorical question put it

self.Length == Number options

1 Like

Thanks for the input! Do you know how to identify the number of options in a dynamic way? In this question it will keep changing based on previous responses.

If all options must always be selected, why ask the question?

You might be able to make use of
self.Missing.Length == 0

Though I’m not sure how that will interact with your filtering.

@sergiy the way you ask the question makes me think there must be a way to create a dynamic list roster populated (& selected) from previous answers?

Scott, how about a fixed roster with enabling condition equivalent to the filtering in the mcq? the original question was about multiselect not a list question.

Thanks for your responses @macuata and @sergiy! In the end we used something similar to what @sergiy suggested by using the filter conditions as validations.

(g1_1a.ContainsAny(1,4,5,6,7)? self.Contains(1): true)
(g1_1a.ContainsAny(2,3)? self.Contains(2): true)
etc. for every option.

@sergiy The reason is a little convoluted but we are taking a long list of dietary responses and filtering them into broader categories that we have pre-determined (i.e. if you ate beef you ate meat, if you ate beans you therefore ate legumes). We want the roster to be based on those categories (meat, legumes, dairy, vegetables, etc.). Since we are the ones determining the categories based on previous responses, list options etc. would be unsuitable.

Neha, this confirms my hypothesis. If the person ate beef, the meat item should just become enabled in your second roster. You should not ask again if the person ate any meat with the MCQ and wait for the option to be selected, because you’ve already established this in the food details roster.

By asking the MCQ you are opening a possibility for a mistake, e.g. if “beef” was the only meat item in the first roster, and it was subsequently changed to “beet”, so no meat item was consumed - you want to have the meats questions suppressed automatically, which is what I advise to Scott in Select All options in multiselect above.

Best, Sergiy

I had the chance to explore the roster functions further and now see what you mean @Sergiy. Using the fixed roster and filters was exactly what I needed. Thanks!