Multiple constraints using AND and OR

Hello,

I have a question in the form the requires multiple constraint as follow:

  • You cannot select “Do not know” and any other option
  • You cannot select “Decline to answer” and any other option
  • You can select a max of 3 options.
    I am using the following syntax but it appears to be wrong.

not(selected(.,“do_not_know”) and count-selected(.) >1) or (not(selected(.,“decline_to_answer”) and count-selected(.) >1)) and (count-selected(.)<=3)

Could you advice? Thank you very much!!

Regards,

Alberto

1 Like

Dear Alberto,

Unfortunately I am also having issues with my constraints. Were you able to figure this out??

···

On Thursday, June 14, 2018 at 10:28:32 AM UTC+2, Alberto Gualtieri wrote:

Hello,

I have a question in the form the requires multiple constraint as follow:

  • You cannot select “Do not know” and any other option
  • You cannot select “Decline to answer” and any other option
  • You can select a max of 3 options.
    I am using the following syntax but it appears to be wrong.

not(selected(.,“do_not_know”) and count-selected(.) >1) or (not(selected(.,“decline_to_answer”) and count-selected(.) >1)) and (count-selected(.)<=3)

Could you advice? Thank you very much!!

Regards,

Alberto

Dear Raina,

You can try this one:

((count-selected(.)>0) and ((count-selected(.)=1 and selected(.,'do_not_know

')) or not(selected(.,'do_not_know

'))) and (count-selected(.)>0) and ((count-selected(.)=1 and selected(.,‘decline_to_answer’)) or not(selected(.,‘decline_to_answer’)))) and (count-selected(.)<=3)

If you copy it directly from here to you xlsform, it might fail due to white spaces, copy into a text editor first or just type it in.

···

On Thu, Sep 20, 2018 at 10:27 PM, Raina Z rain...@gmail.com wrote:

Dear Alberto,

Unfortunately I am also having issues with my constraints. Were you able to figure this out??

On Thursday, June 14, 2018 at 10:28:32 AM UTC+2, Alberto Gualtieri wrote:

Hello,

I have a question in the form the requires multiple constraint as follow:

  • You cannot select “Do not know” and any other option
  • You cannot select “Decline to answer” and any other option
  • You can select a max of 3 options.
    I am using the following syntax but it appears to be wrong.

not(selected(.,“do_not_know”) and count-selected(.) >1) or (not(selected(.,“decline_to_answer”) and count-selected(.) >1)) and (count-selected(.)<=3)

Could you advice? Thank you very much!!

Regards,

Alberto

You received this message because you are subscribed to the Google Groups “KoBoToolbox Users” group.

To unsubscribe from this group and stop receiving emails from it, send an email to kobo-users+unsubscribe@googlegroups.com.

To post to this group, send email to kobo-...@googlegroups.com.

Visit this group at https://groups.google.com/group/kobo-users.

For more options, visit https://groups.google.com/d/optout.

Regards,

Jonathan Munene

+254 714 345 760

https://muneneg.github.io/resume/

Dear @Raina_Z did the solution help? I am curious