Page 1 of 1

One answer checkbox

Posted: May 15th, 2020, 1:02 pm
by lisa_zett
Hey guys,

i have a checkbox with different possible answers. I would like to skip to another question (not the following), if only one answer of the checkbox was chosen.
This did not work out with "if length = 1", maybe because every selection from 0 to 9 has the length of 1?

Thanks for your hepling hand!

Re: One answer checkbox

Posted: May 15th, 2020, 2:03 pm
by josh
Length will give you the maximum length of the field, including the blank space, which does not indicate how many options were checked. However, you can use strip() to remove the blank space to determine the length of the non-blank part which will be the same as the number of options that were checked. So rather than

Code: Select all

length(MYCHECKBOXFIELD) = 1
use

Code: Select all

length(strip(MYCHECKBOXFIELD)) = 1
.

Re: One answer checkbox

Posted: May 16th, 2020, 3:04 am
by lisa_zett
Thanks Josh!

Re: One answer checkbox

Posted: May 19th, 2020, 1:35 pm
by lisa_zett
Hey, I have another question concerning the checkbox.

If I have a list of different activities and the last option is "None of them"...
If the respondent chooses the option "None of them", I would like to get all the other possible options "blocked", so that another choice is not possible anymore.

Re: One answer checkbox

Posted: May 19th, 2020, 2:23 pm
by aaronw
In logic don't let the interviewer advance if none and an another option are both selected. I've attached an example application.

Re: One answer checkbox

Posted: May 20th, 2020, 3:28 am
by lisa_zett
Thank you, but what did you do to not show the different options in the questionnaire again?

Re: One answer checkbox

Posted: May 20th, 2020, 5:25 pm
by aaronw
You can't disable them. My workaround was to not let the CAPI application move forward, if none + another option are selected. Take a look at the example application. The relevant logic is:
if TOILET_OPTION_NONE and (TOILET_OPTION_1 or TOILET_OPTION_2 or TOILET_OPTION_3) then
    errmsg
("If none is selected, then another option cannot be selected.");
   
reenter;
endif;