Unselecting a select_multiple value based on selection of another value

178
2
03-29-2019 10:15 AM
Highlighted
New Contributor III

Is there a way in Survey123 to unselect a select_multiple value based upon the user selecting another value from the same select_multiple question? I have a select_multiple question that defaults to 'None', but I would like 'None' to become unselectable and/or unselected if a user selects any other value from the list. I have tried a number of expressions in the default column, but to no avail. Are there any suggestions as to the best way to achieve this behavior? Is there default column the best place to try to achieve this?

Thanks!

Reply
0 Kudos
2 Replies
Highlighted
Frequent Contributor II

There is a way to count how many choices are picked like count-selected(question).     

How about in the constraint if(selected(None), count-selected(question)<1,1) type of If.  So saying if None is selected and there is more than one selection there is an issue.  If none is not selected then then 1 just lets it go.

Reply
0 Kudos
Highlighted
New Contributor III

Thanks Doug Browning. I couldn't quite get that to work for me very quickly, but I'd probably chalk that up to user error and lack of time on my part. I did end up using a formula from James Tedrick in the comments of Multiple Choice Constraint - A List of values and putting it into a nested if statement:

if(selected(${Question},'Answer1'), not(selected(${Question},'None')), if(selected(${Question},'Answer2'), not(selected(${Question},'None')),true)) 

This nested if statement goes on and on with 6 possible choices so it's not very elegant, but it gets the job done.

It also doesn't actually unselect the 'None' option, but it does prevent the user from selecting "None" in conjunction with the other possible values. Another downside is that it doesn't evaluate the expression until the user submits the form.

Would love to hear some better or different ways to do this.

Reply
0 Kudos