Below is a list of operators you can use to define branching rules, along with their descriptions and examples.
Basic Comparison Operators
| Operator | SQL Symbol | Description | Example |
|---|---|---|---|
| Equal to | = |
Checks if the answer matches the specified value. | Q1 = "Yes" |
| Not Equal to | <> |
Checks if the answer does not match the specified value. | Q1 <> "No" |
| Greater Than | > |
Checks if the answer is greater than the specified value. | Q1 > 10 |
| Less Than | < |
Checks if the answer is less than the specified value. | Q1 < 5 |
| Greater or Equal | >= |
Checks if the answer is greater than or equal to the specified value. | Q1 >= 15 |
| Less or Equal | <= |
Checks if the answer is less than or equal to the specified value. | Q1 <= 20 |
List-Based Operators
List-Based Operators are used to evaluate whether a respondent’s answer matches (or does not match) a set of predefined values. These operators are particularly useful for questions where users can select multiple options, such as checkboxes, and the backend stores the answers as a comma-separated list (e.g., 1,2,3).
| Operator | SQL Symbol | Description | Example |
|---|---|---|---|
| In | IN |
Checks if the answer (or any part of a multi-answer set) is one of the specified values (comma-separated). This is ideal for multi-select questions like checkboxes where the backend answer set might be 1,2,3. If any of the selected values match the specified list, the condition returns true. |
|
| Not In | NOT IN |
Checks if the answer (or any part of a multi-answer set) is not one of the specified values (comma-separated). For multi-select questions, the condition returns true only if none of the selected values match the specified list. |
|
Additional Notes on Multi-Select (Checkbox) Behavior:
- In a checkbox question, when users select multiple options, the backend stores the answers as a comma-separated string. For example, if a user selects options with values
1,2, and3, the answer is stored as1,2,3. - The
INoperator checks if any of the selected values are present in the specified list. For example, if the answer is1,2and the rule isQ1 IN 1,4,5, the condition is true because1is in the list. - The
NOT INoperator checks if none of the selected values are present in the specified list. For example, if the answer is1,2and the rule isQ1 NOT IN 3,4,5, the condition is true because neither1nor2is in3,4,5.
Range Operator
| Operator | SQL Symbol | Description | Example |
|---|---|---|---|
| Between | BETWEEN |
Checks if the answer falls within a specified range (comma-separated). | Q1 Between 10,50 |
Pattern Matching Operators
| Operator | SQL Symbol | Description | Example |
|---|---|---|---|
| Like | LIKE |
Matches the answer against a pattern. Use % for wildcards. |
Q1 LIKE "a%" (starts with ‘a’) |
| Not Like | NOT LIKE |
Checks if the answer does not match the pattern. | Q1 NOT LIKE "%a" (does not end with ‘a’) |
Pattern Examples for LIKE/NOT LIKE:
a%: Answer starts with ‘a’.%a: Answer ends with ‘a’.%a%: Answer contains ‘a’ anywhere.mango: Answer is exactly ‘mango’.
Multi-Answer Operators (For Checkbox Questions)
These operators evaluate the number of selected options in a multi-answer question (e.g., checkboxes), where answers are stored as a comma-separated list (e.g., 1,3,5,7,9).
| Operator | SQL Symbol | Description | Example |
|---|---|---|---|
| EqualLength | = |
Checks if the number of selected options (length of the answer set) equals the specified value. | Q1 EqualLength 5 (e.g., answer: 1,3,5,7,9, length is 5, condition is true) |
| GreaterLength | > |
Checks if the number of selected options (length of the answer set) is greater than the specified value. | Q1 GreaterLength 3 (e.g., answer: 1,3,5,7,9, length is 5, condition is true) |
| LessLength | < |
Checks if the number of selected options (length of the answer set) is less than the specified value. | Q1 LessLength 4 (e.g., answer: 1,3, length is 2, condition is true) |