How to control multiple choice selection

Hello All,

I have one requirement & explaining it below.

Q.L.3. Which method are you using?
It has "type" column, "select_multiple l3".
l3 has following choices.

FEMALE STERILIZATION
MALE STERILIZATION
PILL
IUD
INJECTABLES
OTHER

According to my requirement, if user selects "FEMALE STERILIZATION or MALE
STERILIZATION" then "OTHER" response should not be accepted even it is
selected. So moreover i want to control response selection in multiple
choice.

Please suggest me how can i achieve this.

Thank you.

First, the value strings for a select-multiple should not contain any
spaces. Multiple-choice selections are stored as a space-separated list, so
while the display string can be "MALE STERILIZATION", the value (name in
XLSForm) for that choice must not hvae a space. I.e., must be something
like "MALE_STERILIZATION".

If you do that, you should be able to assemble a constraint expression
using the selected() action.

i.e., to ensure that if male or female sterilization is selected, then
'other' should not be selected, you would have:

if(selected(${q},'MALE_STERILIZATION') or
selected(${q},'FEMALE_STERILIZATION'), not(selected(${q},'OTHER'), true())

Think of this as:
if ( precondition, further-constraint, else-apply-no-constraint )

This is the answer to your question.

ยทยทยท On Wed, Jan 1, 2014 at 11:20 PM, Debasis Patra wrote:

Hello All,

I have one requirement & explaining it below.

Q.L.3. Which method are you using?
It has "type" column, "select_multiple l3".
l3 has following choices.

FEMALE STERILIZATION
MALE STERILIZATION
PILL
IUD
INJECTABLES
OTHER

According to my requirement, if user selects "FEMALE STERILIZATION or MALE
STERILIZATION" then "OTHER" response should not be accepted even it is
selected. So moreover i want to control response selection in multiple
choice.

Please suggest me how can i achieve this.

Thank you.

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en


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

--
Mitch Sundt
Software Engineer
University of Washington
mitchellsundt@gmail.com