The noneChecked
function can be included in conditional statements, using a specified question and a set of options as input. It returns "true" if none of the specified options are selected and "false" if any are selected.
1. Which of the following beverages do you drink on a daily basis?
type: checkbox
randomize: y
1. Sodas
2. Juice
3. Energy drinks
4. Coffee
5. Alcoholic beverages
99. None of these {exclusive: y}
2. Do you <b>ever</b> drink energy drinks?
type: radio
showif: noneChecked($Q1,3)
1. A few times a week
2. Once or twice a week
3. Once or twice a month
4. Once in a blue moon
5. I don't drink energy drinks
Tip! The inverse of noneChecked
is anyChecked
, which may be preferable depending on the logic required.
Details
-
noneChecked
checks for a single option or a set of options. When specifying multiple options, separate them with commas, e.g.,noneChecked($Q1,1,2)
. - To specify consecutive options, use two dots to define a range (also known as series syntax), e.g.,
noneChecked($Q1,1..4,7)
. - If using non-numeric labels for the options, these must be surrounded by single quotes, e.g.,
noneChecked($Q1,'A')
. - When used on a listcall in a
condition
decorator, the[id]
placeholder allows for any option not being selected to make the statement true. -
noneChecked
also accepts option data (custom data) when used in acondition
decorator on a list.
Additional examples
Applying conditions to a listcall
noneChecked
can be used in a condition
decorator on a listcall to apply a condition to every element in that list. The [id]
placeholder is replaced with each option ID from the list. For example, the condition for option 1 becomes noneChecked($Q3,1)
. Any options that weren't selected in Q3 will be shown in the follow up question Q3A.
setlist: RESTAURANTS
1. Ed Boudreaux's Bayou BBQ
2. Rosetta's Kitchen
3. Reza's
4. Jamaican Me Crazy
5. Limones
3. Which restaurants have you previously eaten at?
type: checkbox
optsfrom: RESTAURANTS
3A. Which restaurants that you haven't eaten at would you considered trying?
type: checkbox
optsfrom: RESTAURANTS { if noneChecked($Q3,[id]) }
Likewise, noneChecked
can be used with rowsfrom
in tables as a conditional decorator. To reference a table's row elements, we can combine the table ID with 'R[id]', for ex. '$Q7R[id]'. The noneChecked
function will evaluate each row from Q7 to see which should be included in Q8. Each row from CITIES that didn't receive a 1-4 response in Q7 will be included in Q8.
setlist: CITIES
1. Boston, MA
2. Portland, ME
3. Hartford, CT
4. Burlington, VT
5. Portsmouth, NH
7. How many times have you visited each of these cities?
type: radio table
1. 10+ times
2. 6-10 times
3. 3-5 times
4. 1-2 times
5. Never
rowsfrom: CITIES
8. What is the biggest reason you haven't visited these cities?
type: radio table
1. I am unfamiliar with this city's attractions
2. I don't know anyone in this city
3. This city doesn't seem appealing to me
4. I've heard negative things about this city
rowsfrom: CITIES {if noneChecked($Q7R[id],1..4)}
Using option data
noneChecked
also accepts option data (custom data) when used in a condition
decorator on a list.
In this example, the [TYPE]
option data reference at noneChecked($Q5,[TYPE])
is substituted with the option data from the ANIMAL_GRPS list. This allows for each option in ANIMAL_GRPS to have its own noneChecked
condition. For example, the Mammals option needs the condition noneChecked($Q5,5..7)
to be "true" (that options 5-7 weren't selected) for it to be shown at Q5A.
setlist: ANIMALS
1. Ants
2. Bees
3. Crows
4. Turkeys
5. Dogs
6. Cats
7. Rabbits
8. Iguanas
9. Snakes
setlist: ANIMAL_GRPS
1. Mammals {{TYPE: 5..7}}
2. Reptiles {{TYPE: 8,9}}
3. Insect {{TYPE: 1,2}}
4. Birds {{TYPE: 3,4}}
5. Which animals do you like?
instruct: Select all that apply.
type: checkbox
optsfrom: ANIMALS
5A. Which of these categories of animals is your least favorite?
preface: You did not select animals from the following categories.
type: radio
optsfrom: ANIMAL_GRPS { if noneChecked($Q5,[TYPE]) }
Comments
0 comments
Please sign in to leave a comment.