I have a select multiple question that has the following options:
red, black, blue, orange, unknown, refused
If someone selects unknown and/or refused, I want them to not be able to select red, black, blue, orange.
currently I have this:
not(selected(.,'refused') or selected(.,'unknown') and (selected(.,'red') or selected(.,'black') or selected(.,'blue') or selected(.,'orange'))) |
It seemed to work fine, but I now noticed if you select refuse alone it will throw my contstraint message.
Any input?
Solved! Go to Solution.
Try using the count selected function? if you pick X or Y, count selection should not be greater than one. e.g. update this:
not((selected(.,'refused)) and (count-selected(${currentfield})>1))
I understand that can work. However, I want the logic to be the same if they select 'unknown'.
Thank you @ChristopherCounsell! That worked, I was missing the second parentheses around selected and unknown.
I appreciate your help and time.
Thanks and sorry I forgot to include the 'or' statement in the original answer 😄
Would definitely recommend count-selected, or other ways (string length limits) instead of multiple or statements. Faster and makes it easier to accommodate additional values being added to the list down the track.
Please mark the answer as correct so I can gain those sweet internet points 🙂