Use the passif
and failif
tags to create attention check variables that can be used in evaluating data. Each question with a pass if/fail if
tag generates a tracking variable in the System Fields chapter. The variable is named Qx_ATTN, where x is the original question ID. When the logic specified by the attention flag is met, the _ATTN variable is populated with a value of '1' (passed). When the criteria is not met, the tracking variable is populated with a value of '0' (failed).
ATTN variable option values | |
---|---|
Value | Description |
0 | Not paying attention |
1 |
Paying attention |
passif
and failif
are often used for scenarios such as:
- age verification where an age question is repeated near the end of the survey and verified against the response previously entered
- questions requesting the respondent to type in a specific response or enter a specific value.
Syntax
The input for either pass if
or fail if
can be an option ID, or in more complicated cases, a Boolean expression. If the input evaluates as "true" for pass if
, the check is passed. If the input evaluates as "true" for fail if
, the check is failed.
# In question or table widget; a table widget needs a Boolean expression passif: Option ID or Boolean expression failif: Option ID or Boolean expression
Caution! Be extra vigilant for errors in attention checks which are tied to terminations.
Examples
In the examples below, the showtext
widget is included only to help explain the demonstration code; in live surveys these would not be included.
Option ID passif
For simple pass/fail scenarios, Survey Programmers (SPs) need only specify the option ID for which a respondent will pass or fail an attention check. In the example below, selecting '1' will allow them to pass the attention check.
Option ID failif
Since pass if
is essentially the opposite of fail if
, we could rewrite our previous example as shown below, instead using fail if
.
Boolean expression
In this example, assume that the Rodney's Fireworks brand does not exist, and therefore functions as an attention check. As such, anyone that chooses option '990' will trigger the fail if
condition.
String
It is also possible to evaluate a string from a text question as an attention check point. In this example, the attention check is passed when "alabaster" is entered and failed when anything else is entered.
Table
The following examples illustrates how an attention check can be used within a table to flag unlikely answers, ex: shopping on the moon. The passif
could be written the way it is in the table below or as passif: anyChecked($Q5R990,2)
. Both logic conditions indicate that at Q5, Row 990 (the moon) was selected as 'No' - therefore, the respondent will pass.
Pass and fail count
It is possible to use the number of attention check passes or fails the respondent triggers to control survey logic such as terminations and skip logic. These counts are contained in the attention_pass_count
and attention_fail_count
CheatSweep variables. These variables can be used in conjunction with term if
, goto
, end survey
, or any other widget to control survey routing and so forth, see below for examples.
## to set respondents to T (terminate status) - separate widget
set term: attention_fail
condition: $attention_fail_count > 2
text: Attention checks - 2 or more failed
## to set respondents to T (terminate status) - attached to a question widget
termif: $attention_fail_count >= 2 {text: Attention checks | 2 or more attention checks faild}
## to set respondents to B (bad status)
goto: bad
condition: $attention_fail_count > 2
Note: CheatSweep must be enabled in order for these variables to be present.
The below example once again uses set conditioned text
just to illustrate how the count variables function. In this scenario, not selecting '1' in Q6 would contribute to the attention_fail_count
total, possibly leading to the respondent being terminated.
Comments
0 comments
Please sign in to leave a comment.