The termif
tag defines conditional logic for terminating respondents based on their answers. The termtext
tag or text
decorator customizes the termination text to display in reports.
1. Which age range do you fall into?
type: radio
1. Younger than 18 years old
2. 18 - 24 years old
3. 25 - 44 years old
4. 45 - 64 years old
5. 65 years old or older
termif: anyChecked($Q1,1..3) {text: < 45 yo}
Tip! The qualifyif
tag is the opposite of termif
and may be preferable to match logic specified in a client-copy of a survey. Note, termif
and qualifyif
are opposing functions and should not be applied to the same question/variable.
Details
- To set up termination logic, add the
termif
tag to a question or non-quota variable and define a logical condition (e.g.,anyChecked($Q1,1..3)
) as its value. - The
termtext
tag ortext
decorator are optional, but the addition is recommended for better clarity and brevity in reports and exports. - To streamline code, the
termif
tag andtext
decorator are used in a single line of code as shown above. - The logical condition can reference content on the same page or elsewhere within the survey.
- Once a termination tag is added to the survey source code, the tracking variables
disp
anddisp_first
are added to the survey's data. These variables will use the question text as the reason for termination unless other text is specified. - In a table the default option ID created in
disp
anddisp_first
is prefixed by a 'T' instead of a 'Q' since tables are denoted as such in the system. - You can include multiple
termif
tags on a single question, provided each has a unique ID.
Tip! The decorator version of termif
, term: y
, can be applied directly to an answer option for simple terminations.
Additional examples
Applying multiple 'termif' tags
A question or variable can include multiple termif
tags, each with unique IDs and text
decorators. This ensures individual termination points have distinct labels and descriptive texts in reports and exports.
11. Which isn't a fruit?
type: checkbox
1. Banana
2. Apple
3. Broccoli
4. Tomato
termif: anyChecked($Q11,1,2) {text: Not paying attn} {id: Q11A}
termif: anyChecked($Q11,4) {text: Selected Tomato} {id: Q11B}
Using 'termif' in a table
The termif
tags and text
decorators work the same within tables as they do within standalone questions.
1. What is your role in the following activities?
type: radio table
1. I have no input into the final decision
2. I provide some input into the final decision
3. I make the final decision with input from others
4. I make the final decision alone
rows:
1. Purchasing of IT hardware
2. Purchasing of office supplies
3. Purchasing of building maintenance materials
termif: anyChecked($Q1R2,1,2) {text: Not decision maker for purchasing office supplies}
Placing a 'termtext' tag on a quota
When respondents don't qualify for any quota buckets, they are automatically terminated. Even though the termif
tag is not applied in the example below, the termtext
tag can still customize the reason displayed in the disp
variable.
setlist: BRANDS
1. Doritos
2. Pringles
3. Lay's
13. Which is your favorite?
type: radio
optsfrom: BRANDS
99. None of these
BRANDS. Brand Quota
type: quotas
selectby: counts
termtext: No favorite brands
optsfrom: Q13-[99]
Comments
0 comments
Please sign in to leave a comment.