Validation for a multi select list

Hi,

I am trying to use validation logic so that on a multi select list you
can’t select ‘none’ and any other valid answer. In the wiki pages it says
to do this as follows:

  • Validation constraint so that you can’t select ‘None’ or ‘None of the
    Above’ and another valid answer: “not(selected(., ‘none’) and
    count-selected(.) > 1)”

I have tried copying and pasting this in put get an error message saying ‘
we couldn’t interpret your expression to our format’.

I have played around with it (removing the " " at the start and end,
changing the ’ ’ around none to " " changing not(selected(., to
not(selected(.), adding brackets around the whole count-selected expression
etc) but so far nothing has worked.

Can you tell me what I am doing wrong?!

Thanks

Jenny

Hi Jenny,

The message that says "we couldn’t interpret your expression to our format"
when you “edit” your existing logic is meant to convey that we cannot open
your logic in our simple logic-builder - but we CAN open it in advanced
mode. So when you re-open the expression, you will be prompted to edit it
in “advanced mode”.

This expression should work fine: not(selected(., ‘none’) and
count-selected(.) > 1)

When you write an invalid expression, you should get a "validation error"
in red, and be unable to save the expression from the logic builder to your
form.

Sorry the message was confusing, we’ll work on changing it to something
that makes more sense!

Amelia

··· On Thu, Dec 20, 2012 at 10:07 AM, wrote:

Hi,

I am trying to use validation logic so that on a multi select list you
can’t select ‘none’ and any other valid answer. In the wiki pages it says
to do this as follows:

  • Validation constraint so that you can’t select ‘None’ or ‘None of
    the Above’ and another valid answer: “not(selected(., ‘none’) and
    count-selected(.) > 1)”

I have tried copying and pasting this in put get an error message saying ‘
we couldn’t interpret your expression to our format’.

I have played around with it (removing the " " at the start and end,
changing the ’ ’ around none to " " changing not(selected(., to
not(selected(.), adding brackets around the whole count-selected expression
etc) but so far nothing has worked.

Can you tell me what I am doing wrong?!

Thanks

Jenny

Also - Not sure if this applies to you, but this expression will only work
if the “none” option you have in your multi-select has the Question ID
"none". If, for example, your none option had a Question ID that read
"no_answer" then the expression would need to look like this:
not(selected(., ‘no_answer’) and count-selected(.) > 1)

Jeremy

··· On Thu, Dec 20, 2012 at 10:00 PM, Amelia Sagoff wrote:

Hi Jenny,

The message that says “we couldn’t interpret your expression to our
format” when you “edit” your existing logic is meant to convey that we
cannot open your logic in our simple logic-builder - but we CAN open it in
advanced mode. So when you re-open the expression, you will be prompted to
edit it in “advanced mode”.

This expression should work fine: not(selected(., ‘none’) and
count-selected(.) > 1)

When you write an invalid expression, you should get a "validation error"
in red, and be unable to save the expression from the logic builder to your
form.

Sorry the message was confusing, we’ll work on changing it to something
that makes more sense!

Amelia

On Thu, Dec 20, 2012 at 10:07 AM, jenny_hall33@yahoo.co.uk wrote:

Hi,

I am trying to use validation logic so that on a multi select list you
can’t select ‘none’ and any other valid answer. In the wiki pages it says
to do this as follows:

  • Validation constraint so that you can’t select ‘None’ or ‘None of
    the Above’ and another valid answer: “not(selected(., ‘none’) and
    count-selected(.) > 1)”

I have tried copying and pasting this in put get an error message saying
’ we couldn’t interpret your expression to our format’.

I have played around with it (removing the " " at the start and end,
changing the ’ ’ around none to " " changing not(selected(., to
not(selected(.), adding brackets around the whole count-selected expression
etc) but so far nothing has worked.

Can you tell me what I am doing wrong?!

Thanks

Jenny


Jeremy Wacksman
Field Manager, India - Dimagi, Inc.
(+91) 8802 787 333

Thanks for the answers - I did have the question named ‘none’ - I was just
misinterpreting the pop up box as telling me that what was written in the
advanced editor was working. I have tested and it is working as it should.
Thanks!

··· On Thursday, December 20, 2012 6:19:38 PM UTC, Jeremy Wacksman wrote: > > Also - Not sure if this applies to you, but this expression will only work > if the "none" option you have in your multi-select has the Question ID > "none". If, for example, your none option had a Question ID that read > "no_answer" then the expression would need to look like this: > not(selected(., 'no_answer') and count-selected(.) > 1) > > Jeremy > > > On Thu, Dec 20, 2012 at 10:00 PM, Amelia Sagoff <asa...@dimagi.com wrote: > >> Hi Jenny, >> >> The message that says "we couldn't interpret your expression to our >> format" when you "edit" your existing logic is meant to convey that we >> cannot open your logic in our simple logic-builder - but we CAN open it in >> advanced mode. So when you re-open the expression, you will be prompted to >> edit it in "advanced mode". >> >> This expression should work fine: not(selected(., 'none') and >> count-selected(.) > 1) >> >> When you write an invalid expression, you should get a "validation error" >> in red, and be unable to save the expression from the logic builder to your >> form. >> >> Sorry the message was confusing, we'll work on changing it to something >> that makes more sense! >> >> Amelia >> >> >> On Thu, Dec 20, 2012 at 10:07 AM, <jenny_...@yahoo.co.uk >wrote: >> >>> Hi, >>> >>> I am trying to use validation logic so that on a multi select list you >>> can't select 'none' and any other valid answer. In the wiki pages it says >>> to do this as follows: >>> >>> >>> - Validation constraint so that you can't select 'None' or 'None of >>> the Above' and another valid answer: "not(selected(., 'none') and >>> count-selected(.) > 1)" >>> >>> I have tried copying and pasting this in put get an error message saying >>> ' we couldn't interpret your expression to our format'. >>> >>> I have played around with it (removing the " " at the start and end, >>> changing the ' ' around none to " " changing not(selected(., to >>> not(selected(.), adding brackets around the whole count-selected expression >>> etc) but so far nothing has worked. >>> >>> Can you tell me what I am doing wrong?! >>> >>> Thanks >>> >>> Jenny >>> >> >> > > > -- > Jeremy Wacksman > Field Manager, India - Dimagi, Inc. > (+91) 8802 787 333 >