One answer checkbox

Discussions about CSEntry
Post Reply
lisa_zett
Posts: 9
Joined: May 15th, 2020, 12:55 pm

One answer checkbox

Post 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!
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: One answer checkbox

Post 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
.
lisa_zett
Posts: 9
Joined: May 15th, 2020, 12:55 pm

Re: One answer checkbox

Post by lisa_zett »

Thanks Josh!
lisa_zett
Posts: 9
Joined: May 15th, 2020, 12:55 pm

Re: One answer checkbox

Post 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.
aaronw
Posts: 565
Joined: June 9th, 2016, 9:38 am
Location: Washington, DC

Re: One answer checkbox

Post 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.
Attachments
Checkbox.zip
(2.72 KiB) Downloaded 189 times
lisa_zett
Posts: 9
Joined: May 15th, 2020, 12:55 pm

Re: One answer checkbox

Post by lisa_zett »

Thank you, but what did you do to not show the different options in the questionnaire again?
aaronw
Posts: 565
Joined: June 9th, 2016, 9:38 am
Location: Washington, DC

Re: One answer checkbox

Post 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;
Post Reply