How to control the number of selections in a select multiple question?

@Kal_Lam

  1. How can limit number of selection of options in a multiple question
    For example, if Q1 have 10 options the maximum selection will be 5 or less.

  2. How can I compulsory 5 option selection in a multiple question
    For example, if Q1 have 10 options, 5 options must be selected not more, not less than 5

  3. How can I compulsory 5 option selection or more in a multiple question
    For example, if Q1 have 10 options, 5 options must be selected or more

    1. How can limit number of selection of options in a multiple question with a range
      For example, if Q1 have 10 options the maximum selection will between 5 and 7 options.

Thanks.

@FEMMMY, you should be able to do it as outlined in the post discussed previously:

@Kal_Lam

Great,
Thanks so much,
I will check and revert

1 Like

@Kal_Lam

Thanks the logic worked

1 Like

Hello @Kal_Lam
I used ‘‘count-selected(.)=3 and not(selected(., ‘99’) and count-selected(.)>1)’’ for constraint To limit selection to 3 option and the "None’’ should be excluded . But none was not excluded and the message for ‘‘None’’ did not display

How do I do it please

OK, you could do this by following the post discussed previously:

Hello @Kal_Lam

Thanks for your response.

The logic did not work,

What I need is adding None and maximum selection of 3 or 5 options,

In The Question, there are about 7 options and the maximum of 5 must be selected and if None is selected, it will move to next question neglecting the maximum option.

This simply means that if anyone select less than 5 options it will not go to the next questions until 5 options are selected and if anyone select “None of the Above”, it will move to the next question not allowing other options since it is “None of the Above”

Hello @FEMMMY,
it just seems a problem of your LOGIC. Would you mind, please, to formulate the constraints first as simple text (or decission table), using and/or expressions and brackets, before coding?

1 Like

Hello @wroos @Kal_Lam

Are you suggesting that I use it this way?

“count-selected(.)=3” or “not(selected(., ‘99’) and count-selected(.)>1)”
“not(selected(., ‘99’) and count-selected(.)>1)” or “count-selected(.)=3”
“count-selected(.)=3” or “not(selected(., ‘99’) and count-selected(.)>1)”
“not(selected(., ‘99’) and count-selected(.)>1)” and “count-selected(.)=3”

TRUE (Logic):

  • only “None” selected
    or
  • minimum of … selected, but NOT (“None” selected)
1 Like

@Kal_Lam @wroos

This logic is not working,

In the question, there are about 8 options, 5 options must be selected before moving to next questions, if less than 5 or more than five options is selected it will not go to the next question,
However, “None of the above” will be among the 8 options, so if “None of the above” is selected it will it will move to the next questions without selecting 5 options.

count-selected(.)=5 and not(selected(., ‘8’) and (selected(.,’7’) or selected(.,’6’) or selected(.,’5’) or selected(.,’4’) or selected(.,’3’) or selected(.,’2’) or selected(.,’1’)))

count-selected(.)<=5 and not(selected(., ‘8’) and (selected(.,’7’) or selected(.,’6’) or selected(.,’5’) or selected(.,’4’) or selected(.,’3’) or selected(.,’2’) or selected(.,’1’)))

This are the two codes I have used.

Try this (assuming option 99 corresponds to ‘None of the Above’):

constraint: count-selected(.)=5 or selected(., '99')

Note, you aren’t precise about what to do if other options are selected prior to the user selecting ‘None of the Above’ (eg this is invalid? or we just ignore them?)

1 Like

Hello,
the proposed constraint would allow to combine “None of the Above” with any of the other choice(s) and to use it alone. Does this make sense? I would think “None …” should be exclusive.

@FEMMMY
Could you explain the rule more clearly, please, in simple text form. See above
https://community.kobotoolbox.org/t/how-to-control-the-nufmber-of-selections-in-a-select-multiple-question/29077/11?u=wroos

1 Like

Okay
Thanks,
I will and revert
Regards

1 Like

Yup, I dont disagree (hence my caveat…). If you’d like to make ‘None of the Above’ mutually exclusive to any other options, try something like:

constraint: (selected(., '99') and count-selected(.)=1) or (not(selected(., '99')) and count-selected(.)=5)

2 Likes

Hi,
alternate coding can !be
constraint: if( selected(., ‘99’), count-selected(.)=1, count-selected(.)=5 )

2 Likes