5 Survey question expressions
Professionals can specify expressions on survey questions. An expression will determine whether the survey question will be shown to the participant or not. For trigger expressions, see Chapter 7
5.1 Instructions
As of now, expressions based on the following question types are supported:
- Boolean
- List
- Multi-Select
- Slider
- Rating
- Time
- Likert
- Short Answer
5.1.1 Syntax
Expressions must be of the format:
ID OPERATOR VALUE
And ID can be any specified question identifier (see 5.2 Example).
OPERATOR is one of the following:
- ==
- !=
- >
- <
- >=
- <=
- MATCHES
- CONTAINS
- !CONTAINS
Where VALUE is either TRUE, FALSE, numeric value, an answer ID, a regex pattern or a timestamp. See below for more information.
Note that the >, < >= and <= are only compatible with numeric or timestamp values. Additionally, CONTAINS and !CONTAINS are only compatible with Multi-Select questions and options.
Expressions can be combined with AND and OR operators, for example:
id1 == TRUE OR id2 <= 5 AND A !CONTAINS b
5.1.2 Possible value combinations
5.1.2.1 Boolean
Boolean values, i.e. TRUE or FALSE, can be combined with the following question types:
- Boolean
Example:
A == TRUE
5.1.2.2 Numeric
Numeric values can be combined with the following question types:
- Rating
- Slider
- Likert, where:
- 0 = “Not at all”
- 1 = “Several Times”
- 2 = “More than Half the Time”
- 3 = “Nearly All the Time”
- List, where the numeric value is one of the option values
Example:
A <= 3
Note: for List questions, the numeric value needs to be specified when creating the question options.
5.1.2.3 Variable (answer ID)
Variable values can be combined with the following question types:
- Multi-Select
Note: be sure to set variable names to the answers you’ve specified.
Example:
A CONTAINS a AND A !CONTAINS b
5.1.2.4 Regex pattern
Regex values can be combined with the following question types:
- Text
- Short Answer
Note: regex is only compatible with the MATCHES operator
Example:
A MATCHES /dog/gi
5.1.2.5 Timestamp
Regex values can be combined with the following question types:
- Time
Note: all operators, except MATCHES, are compatible with timestamp values.
Example:
A >= 21:00 OR A < 9:30
5.2 Expression configuration example
While creating a Survey activity:
- First create a question of any of the allowed Question Type.
- Give this question an “ID” and a “Question Text”.
Add a second question by clicking “Add Item”.
Give this second question a “Question Text” and specify the condition under which this question should be shown by filling in “Logical expression”.
e.g. above question will be shown to the participant if he/she has answered the first question with “Yes”