Multiple constraints [24/03/2021]

1. What is the problem? Be very detailed.

I have a multiple choice question that should allow the user to tick only the first four at most, or just the penultimate or just the last.

2. What app or server are you using and on what device and operating system? Include version numbers.

I am creating the spreadsheets with the settings and algorithms in excel and testing on the website https://enketo.getodk.org/

3. What you have you tried to fix the problem?

I created this algorithm, but it still allows the user to mark the last alternative along with some other.

4. What steps can we take to reproduce the problem?

count-selected(.) < 5 and not(selected(.,'04')) or not(selected(.,'99')) and not(selected(.,'00')) and not(selected(.,'01')) and not(selected(.,'02')) and not(selected(.,'03'))

5. Anything else we should know or have? If you have a test form or screenshots or logs, attach below.

The constraint is not working for the last alternative:
But it works for and penultimate:

Hi @kelvenluiz
We're glad you're here. When you get a chance, please introduce yourself on this forum thread.

What about something like this:

(count-selected(.)=1 and (selected(.,'5') or selected(.,'6')))
or
(count-selected(.)>0 and not(selected(.,'5')) and not(selected(.,'6')))

you need to update your values because I used numbers 1-6.

1 Like