The term if
tag defines conditional logic for terminating respondents based on their answers. The term text
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
term if: anyChecked($Q1,1..3) {text: < 45 yo}
Tip! The qualify if
tag is the opposite of term if
and may be preferable to match logic specified in a client-copy of a survey. Note, term if
and qualify if
are opposing functions and should not be applied to the same question/variable.
Details
- To set up termination logic, add the
term if
tag to a question or non-quota variable and define a logical condition (e.g.,anyChecked($Q1,1..3)
) as its value. - The
term text
tag ortext
decorator is optional but recommended for better clarity and brevity in reports and exports. - To streamline code, the
term if
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. - You can include multiple
term if
tags on a single question, provided each has a unique ID.
Tip! The decorator version of term if
, term: y
, can be applied directly to an answer option for simple terminations.
Additional examples
Applying multiple 'term if' tags
A question or variable can include multiple term if
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
term if: anyChecked($Q11,1,2) {text: Not paying attn} {id: Q11A}
term if: anyChecked($Q11,4) {text: Selected Tomato} {id: Q11B}
Using 'term if' in a table
The term if
tags and text
decorators work the same within tables as they do within 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
term if: anyChecked($Q1R2,1,2) {text: Not decision maker for purchasing office supplies}
Placing a 'term text' tag on a quota
When respondents don't qualify for any quota buckets, they are automatically terminated. Even though the term if
tag is not applied in the example below, the term text
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
term text: No favorite brands
optsfrom: Q13-[99]
Comments
0 comments
Please sign in to leave a comment.