Select multiple values by default

I have a multi-select field and i want 2 choices ie, say 2 and 3 to be selected by default. How is it possible. Also attaching an xls form for reference.

Dear @khasaab,
it’s easy. You can use default or calculation.
select_multiple items are stored in a space-separated string.
Like in general, default will not be an option for dynamic values.
I add an examples for both options here:
Preset Multiple_Select.xlsx (12.2 KB)
Kind regards

1 Like

Thanks it worked actually the name of the choices in my list was number so it was throwing an error with the same code i used earlier, when Alpha was used in the name it worked fine for the default but for calculation part it worked for both.


Just adding to your reply with the same example file you shared. How can we put a conditional default like for eg: if there is a Select one question with Choices 1 and 2 above Multiple Select Question and we have to display 2 fields by default if Select one is selected as 1 only other wise no choices will be selected if 2 is selected in the Select one question.

@khasaab just wanted to add the same approach which @wroos had pointed out, which you say did not work for a numerical name. I wanted to get back to this topic as it could benefit our community.

In the survey tab of your xlsform:

Image 1

In the choices tab of your xlsform:

Image 2

Data entry screen as seen in Enketo:

Reference xlsform:

Preset Multiple_Select.xlsx (12.2 KB)

1 Like