Validation for multi-selection

Hi, I have a question regarding validation rules for multi-select.

I would like to use the ‘not select’ logic to make sure that participants
cannot select* ‘don’t know’ and another answer* AND ‘refuse to answer’ and
another answer
. I have successfully used not(selected(., ‘999’) and
count-selected(.) > 1), but don’t know how to add in the ‘refuse to answer’
(666) within the function. Thank you for your help!

What activity have you participated in? (SELECT ALL THAT APPLY).

Producer group…1

Livestock group……………………….……2

Irrigation group.………………….……….……3

Marketing group……………….………………4

Trainings……………………………………5

Extension services…………………………6

Agriculture inputs (seeds and livestock)……7

WE/VSL…………………………………….…8

Care Group……………………………………9

VCPC …………………………………….….10

Others………………………………………….11

Specify____________________________

Don’t know…………………………………….999

Refuse to answer……………………………666

Hi Emily,

I think adding an ‘or’ statement will do what you’re looking for, IE:

not(selected(., ‘999’) or selected(., ‘666’) and count-selected(.) > 1)

(Note that this works because CommCare evaluates operations left to right
https://confluence.dimagi.com/pages/viewpage.action?pageId=32643680)

Cheers,
Will

··· On Tue, Sep 13, 2016 at 1:22 PM, Emily Epsten wrote:

Hi, I have a question regarding validation rules for multi-select.

I would like to use the ‘not select’ logic to make sure that participants
cannot select* ‘don’t know’ and another answer* AND 'refuse to answer’
and another answer
. I have successfully used not(selected(., ‘999’) and
count-selected(.) > 1), but don’t know how to add in the ‘refuse to answer’
(666) within the function. Thank you for your help!

What activity have you participated in? (SELECT ALL THAT APPLY).

Producer group…1

Livestock group……………………….……2

Irrigation group.………………….……….……3

Marketing group……………….………………4

Trainings……………………………………5

Extension services…………………………6

Agriculture inputs (seeds and livestock)……7

WE/VSL…………………………………….…8

Care Group……………………………………9

VCPC …………………………………….….10

Others………………………………………….11

Specify____________________________

Don’t know…………………………………….999

Refuse to answer……………………………666


You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Thanks, Will!

Emily

··· On Tue, Sep 13, 2016 at 11:23 AM, William Pride wrote:

Hi Emily,

I think adding an ‘or’ statement will do what you’re looking for, IE:

not(selected(., ‘999’) or selected(., ‘666’) and count-selected(.) > 1)

(Note that this works because CommCare evaluates operations left to right
https://confluence.dimagi.com/pages/viewpage.action?pageId=32643680)

Cheers,
Will

On Tue, Sep 13, 2016 at 1:22 PM, Emily Epsten emilyepsten@gmail.com wrote:

Hi, I have a question regarding validation rules for multi-select.

I would like to use the ‘not select’ logic to make sure that participants
cannot select* ‘don’t know’ and another answer* AND 'refuse to answer’
and another answer
. I have successfully used not(selected(., ‘999’) and
count-selected(.) > 1), but don’t know how to add in the ‘refuse to answer’
(666) within the function. Thank you for your help!

What activity have you participated in? (SELECT ALL THAT APPLY).

Producer group…1

Livestock group……………………….……2

Irrigation group.………………….……….……3

Marketing group……………….………………4

Trainings……………………………………5

Extension services…………………………6

Agriculture inputs (seeds and livestock)……7

WE/VSL…………………………………….…8

Care Group……………………………………9

VCPC …………………………………….….10

Others………………………………………….11

Specify____________________________

Don’t know…………………………………….999

Refuse to answer……………………………666


You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


You received this message because you are subscribed to a topic in the
Google Groups “commcare-users” group.
To unsubscribe from this topic, visit https://groups.google.com/d/
topic/commcare-users/x2BMliGgV-o/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hi Will,

I wanted to follow-up on the question above. I realized if I select only
’don’t know’, then it says the response is invalid. However, if I select
only ‘refuse to answer’ it works. I still want to be able to select
multiple options, just not ‘don’t know’ and anything else and ‘refuse to
answer’ and anything else
together. Thoughts?

Thanks for your help!

Emily

··· On Wed, Sep 14, 2016 at 7:12 AM, Emily Epsten wrote:

Thanks, Will!

Emily

On Tue, Sep 13, 2016 at 11:23 AM, William Pride wpride@dimagi.com wrote:

Hi Emily,

I think adding an ‘or’ statement will do what you’re looking for, IE:

not(selected(., ‘999’) or selected(., ‘666’) and count-selected(.) > 1)

(Note that this works because CommCare evaluates operations left to right
https://confluence.dimagi.com/pages/viewpage.action?pageId=32643680)

Cheers,
Will

On Tue, Sep 13, 2016 at 1:22 PM, Emily Epsten emilyepsten@gmail.com wrote:

Hi, I have a question regarding validation rules for multi-select.

I would like to use the ‘not select’ logic to make sure that
participants cannot select* ‘don’t know’ and another answer* AND ‘refuse
to answer’ and another answer
. I have successfully used
not(selected(., ‘999’) and count-selected(.) > 1), but don’t know how to
add in the ‘refuse to answer’ (666) within the function. Thank you for your
help!

What activity have you participated in? (SELECT ALL THAT APPLY).

Producer group…1

Livestock group……………………….……2

Irrigation group.………………….……….……3

Marketing group……………….………………4

Trainings……………………………………5

Extension services…………………………6

Agriculture inputs (seeds and livestock)……7

WE/VSL…………………………………….…8

Care Group……………………………………9

VCPC …………………………………….….10

Others………………………………………….11

Specify____________________________

Don’t know…………………………………….999

Refuse to answer……………………………666


You received this message because you are subscribed to the Google
Groups “commcare-users” group.
To unsubscribe from this group and stop receiving emails from it, send
an email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


You received this message because you are subscribed to a topic in the
Google Groups “commcare-users” group.
To unsubscribe from this topic, visit https://groups.google.com/d/to
pic/commcare-users/x2BMliGgV-o/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hey Emily,

Sorry about that - I think using parenthesis such that you have

not((selected(., ‘999’) or selected(., ‘666’)) and count-selected(.) > 1)

will work.

Cheers,
Will

··· On Mon, Sep 19, 2016 at 5:45 PM, Emily Epsten wrote:

Hi Will,

I wanted to follow-up on the question above. I realized if I select only
’don’t know’, then it says the response is invalid. However, if I select
only ‘refuse to answer’ it works. I still want to be able to select
multiple options, just not ‘don’t know’ and anything else and ‘refuse
to answer’ and anything else
together. Thoughts?

Thanks for your help!

Emily

On Wed, Sep 14, 2016 at 7:12 AM, Emily Epsten emilyepsten@gmail.com wrote:

Thanks, Will!

Emily

On Tue, Sep 13, 2016 at 11:23 AM, William Pride wpride@dimagi.com wrote:

Hi Emily,

I think adding an ‘or’ statement will do what you’re looking for, IE:

not(selected(., ‘999’) or selected(., ‘666’) and count-selected(.) > 1)

(Note that this works because CommCare evaluates operations left to
right
https://confluence.dimagi.com/pages/viewpage.action?pageId=32643680)

Cheers,
Will

On Tue, Sep 13, 2016 at 1:22 PM, Emily Epsten emilyepsten@gmail.com wrote:

Hi, I have a question regarding validation rules for multi-select.

I would like to use the ‘not select’ logic to make sure that
participants cannot select* ‘don’t know’ and another answer* AND ‘refuse
to answer’ and another answer
. I have successfully used
not(selected(., ‘999’) and count-selected(.) > 1), but don’t know how to
add in the ‘refuse to answer’ (666) within the function. Thank you for your
help!

What activity have you participated in? (SELECT ALL THAT APPLY).

Producer group…1

Livestock group……………………….……2

Irrigation group.………………….……….……3

Marketing group……………….………………4

Trainings……………………………………5

Extension services…………………………6

Agriculture inputs (seeds and livestock)……7

WE/VSL…………………………………….…8

Care Group……………………………………9

VCPC …………………………………….….10

Others………………………………………….11

Specify____________________________

Don’t know…………………………………….999

Refuse to answer……………………………666


You received this message because you are subscribed to the Google
Groups “commcare-users” group.
To unsubscribe from this group and stop receiving emails from it, send
an email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


You received this message because you are subscribed to a topic in the
Google Groups “commcare-users” group.
To unsubscribe from this topic, visit https://groups.google.com/d/to
pic/commcare-users/x2BMliGgV-o/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Thank you!

··· On Tue, Sep 20, 2016 at 1:10 PM, William Pride wrote:

Hey Emily,

Sorry about that - I think using parenthesis such that you have

not((selected(., ‘999’) or selected(., ‘666’)) and count-selected(.) > 1)

will work.

Cheers,
Will

On Mon, Sep 19, 2016 at 5:45 PM, Emily Epsten emilyepsten@gmail.com wrote:

Hi Will,

I wanted to follow-up on the question above. I realized if I select only
’don’t know’, then it says the response is invalid. However, if I select
only ‘refuse to answer’ it works. I still want to be able to select
multiple options, just not ‘don’t know’ and anything else and ‘refuse
to answer’ and anything else
together. Thoughts?

Thanks for your help!

Emily

On Wed, Sep 14, 2016 at 7:12 AM, Emily Epsten emilyepsten@gmail.com wrote:

Thanks, Will!

Emily

On Tue, Sep 13, 2016 at 11:23 AM, William Pride wpride@dimagi.com wrote:

Hi Emily,

I think adding an ‘or’ statement will do what you’re looking for, IE:

not(selected(., ‘999’) or selected(., ‘666’) and count-selected(.) > 1)

(Note that this works because CommCare evaluates operations left to
right
https://confluence.dimagi.com/pages/viewpage.action?pageId=32643680)

Cheers,
Will

On Tue, Sep 13, 2016 at 1:22 PM, Emily Epsten emilyepsten@gmail.com wrote:

Hi, I have a question regarding validation rules for multi-select.

I would like to use the ‘not select’ logic to make sure that
participants cannot select* ‘don’t know’ and another answer* AND ‘refuse
to answer’ and another answer
. I have successfully used
not(selected(., ‘999’) and count-selected(.) > 1), but don’t know how to
add in the ‘refuse to answer’ (666) within the function. Thank you for your
help!

What activity have you participated in? (SELECT ALL THAT APPLY).

Producer group…1

Livestock group……………………….……2

Irrigation group.………………….……….……3

Marketing group……………….………………4

Trainings……………………………………5

Extension services…………………………6

Agriculture inputs (seeds and livestock)……7

WE/VSL…………………………………….…8

Care Group……………………………………9

VCPC …………………………………….….10

Others………………………………………….11

Specify____________________________

Don’t know…………………………………….999

Refuse to answer……………………………666


You received this message because you are subscribed to the Google
Groups “commcare-users” group.
To unsubscribe from this group and stop receiving emails from it, send
an email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


You received this message because you are subscribed to a topic in the
Google Groups “commcare-users” group.
To unsubscribe from this topic, visit https://groups.google.com/d/to
pic/commcare-users/x2BMliGgV-o/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


You received this message because you are subscribed to a topic in the
Google Groups “commcare-users” group.
To unsubscribe from this topic, visit https://groups.google.com/d/
topic/commcare-users/x2BMliGgV-o/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hello William

I have also same problem. But I follow you suggested formula and its work.

Thank you so much.

Regards
Latika

··· On Wed, Sep 21, 2016 at 2:34 AM, Emily Epsten wrote:

Thank you!

On Tue, Sep 20, 2016 at 1:10 PM, William Pride wpride@dimagi.com wrote:

Hey Emily,

Sorry about that - I think using parenthesis such that you have

not((selected(., ‘999’) or selected(., ‘666’)) and count-selected(.) > 1)

will work.

Cheers,
Will

On Mon, Sep 19, 2016 at 5:45 PM, Emily Epsten emilyepsten@gmail.com wrote:

Hi Will,

I wanted to follow-up on the question above. I realized if I select only
’don’t know’, then it says the response is invalid. However, if I select
only ‘refuse to answer’ it works. I still want to be able to select
multiple options, just not ‘don’t know’ and anything else and ‘refuse
to answer’ and anything else
together. Thoughts?

Thanks for your help!

Emily

On Wed, Sep 14, 2016 at 7:12 AM, Emily Epsten emilyepsten@gmail.com wrote:

Thanks, Will!

Emily

On Tue, Sep 13, 2016 at 11:23 AM, William Pride wpride@dimagi.com wrote:

Hi Emily,

I think adding an ‘or’ statement will do what you’re looking for, IE:

not(selected(., ‘999’) or selected(., ‘666’) and count-selected(.) > 1)

(Note that this works because CommCare evaluates operations left to
right
https://confluence.dimagi.com/pages/viewpage.action?pageId=32643680)

Cheers,
Will

On Tue, Sep 13, 2016 at 1:22 PM, Emily Epsten emilyepsten@gmail.com wrote:

Hi, I have a question regarding validation rules for multi-select.

I would like to use the ‘not select’ logic to make sure that
participants cannot select* ‘don’t know’ and another answer* AND ‘refuse
to answer’ and another answer
. I have successfully used
not(selected(., ‘999’) and count-selected(.) > 1), but don’t know how to
add in the ‘refuse to answer’ (666) within the function. Thank you for your
help!

What activity have you participated in? (SELECT ALL THAT APPLY).

Producer group…1

Livestock group……………………….……2

Irrigation group.………………….……….……3

Marketing group……………….………………4

Trainings……………………………………5

Extension services…………………………6

Agriculture inputs (seeds and livestock)……7

WE/VSL…………………………………….…8

Care Group……………………………………9

VCPC …………………………………….….10

Others………………………………………….11

Specify____________________________

Don’t know…………………………………….999

Refuse to answer……………………………666


You received this message because you are subscribed to the Google
Groups “commcare-users” group.
To unsubscribe from this group and stop receiving emails from it,
send an email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


You received this message because you are subscribed to a topic in the
Google Groups “commcare-users” group.
To unsubscribe from this topic, visit https://groups.google.com/d/to
pic/commcare-users/x2BMliGgV-o/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


You received this message because you are subscribed to the Google
Groups “commcare-users” group.
To unsubscribe from this group and stop receiving emails from it, send
an email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


You received this message because you are subscribed to a topic in the
Google Groups “commcare-users” group.
To unsubscribe from this topic, visit https://groups.google.com/d/to
pic/commcare-users/x2BMliGgV-o/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Glad to hear it!

Cheers,
Will

··· On Fri, Oct 7, 2016 at 1:33 AM, Latika Sb wrote:

Hello William

I have also same problem. But I follow you suggested formula and its work.

Thank you so much.

Regards
Latika

On Wed, Sep 21, 2016 at 2:34 AM, Emily Epsten emilyepsten@gmail.com wrote:

Thank you!

On Tue, Sep 20, 2016 at 1:10 PM, William Pride wpride@dimagi.com wrote:

Hey Emily,

Sorry about that - I think using parenthesis such that you have

not((selected(., ‘999’) or selected(., ‘666’)) and count-selected(.) > 1)

will work.

Cheers,
Will

On Mon, Sep 19, 2016 at 5:45 PM, Emily Epsten emilyepsten@gmail.com wrote:

Hi Will,

I wanted to follow-up on the question above. I realized if I select
only ‘don’t know’, then it says the response is invalid. However, if I
select only ‘refuse to answer’ it works. I still want to be able to select
multiple options, just not ‘don’t know’ and anything else and ‘refuse
to answer’ and anything else
together. Thoughts?

Thanks for your help!

Emily

On Wed, Sep 14, 2016 at 7:12 AM, Emily Epsten emilyepsten@gmail.com wrote:

Thanks, Will!

Emily

On Tue, Sep 13, 2016 at 11:23 AM, William Pride wpride@dimagi.com wrote:

Hi Emily,

I think adding an ‘or’ statement will do what you’re looking for, IE:

not(selected(., ‘999’) or selected(., ‘666’) and count-selected(.) >
1)

(Note that this works because CommCare evaluates operations left to
right
https://confluence.dimagi.com/pages/viewpage.action?pageId=32643680
)

Cheers,
Will

On Tue, Sep 13, 2016 at 1:22 PM, Emily Epsten emilyepsten@gmail.com wrote:

Hi, I have a question regarding validation rules for multi-select.

I would like to use the ‘not select’ logic to make sure that
participants cannot select* ‘don’t know’ and another answer* AND ‘refuse
to answer’ and another answer
. I have successfully used
not(selected(., ‘999’) and count-selected(.) > 1), but don’t know how to
add in the ‘refuse to answer’ (666) within the function. Thank you for your
help!

What activity have you participated in? (SELECT ALL THAT APPLY).

Producer group…1

Livestock group……………………….……2

Irrigation group.………………….……….……3

Marketing group……………….………………4

Trainings……………………………………5

Extension services…………………………6

Agriculture inputs (seeds and livestock)……7

WE/VSL…………………………………….…8

Care Group……………………………………9

VCPC …………………………………….….10

Others………………………………………….11

Specify____________________________

Don’t know…………………………………….999

Refuse to answer……………………………666


You received this message because you are subscribed to the Google
Groups “commcare-users” group.
To unsubscribe from this group and stop receiving emails from it,
send an email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


You received this message because you are subscribed to a topic in
the Google Groups “commcare-users” group.
To unsubscribe from this topic, visit https://groups.google.com/d/to
pic/commcare-users/x2BMliGgV-o/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


You received this message because you are subscribed to the Google
Groups “commcare-users” group.
To unsubscribe from this group and stop receiving emails from it, send
an email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


You received this message because you are subscribed to a topic in the
Google Groups “commcare-users” group.
To unsubscribe from this topic, visit https://groups.google.com/d/to
pic/commcare-users/x2BMliGgV-o/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.