Show/Hide Logic
When setting up a conditional part of your expressions, you can combine logic conditions using AND, OR and NOT operators as well as group them with parentheses ().
You can build complex logical conditions using Add sub-group (1), Add rule (2) and Add group (3) options and AND/OR/AND NOT/OR NOT logical operators.
Valid symbols in logic expressions
Valid symbols | Examples |
Letters: Q, A, C | Q1, Q1.C4, Q2.A3 |
Numbers: 1-9, 10 - more | Q9, Q23.A5 |
Dots: ... | Q3.A5.C7 |
Operators: AND(=&&), OR (=||), NOT (=!) | Q3.A1 AND Q3.A3, Q7.A3.C1 OR Q7.A3.C2, NOT Q2.A1 |
Parentheses: () | (Q1 AND Q3.A2) OR (Q5.A1 AND Q5.A3) Note: to use complex expressions with double brackets, insert spaces between the brackets: |
Logic Operators
Operator AND denotes that all the combined logic conditions are met
ℹ Example
If Q1.A1 AND Q1.A3, meaning if both answer 1 and answer 3 are selected in question 1.
Operator OR denotes that at least one of the combined logic conditions is met.
ℹ Example
If Q1.A1 OR Q1.A3, meaning if either answer 1 or answer 3 is selected in question 1.
Operator NOT denotes that a logic condition is not fulfilled. You can put it at the beginning of a logic condition or after AND, OR operators.
ℹ Example
If NOT Q1.A1, meaning if answer1 is not selected in question 1.
You can use AND, OR, NOT operators in the same logic expression simultaneously. Use parentheses to make your logic unambiguous.
ℹ Example
If (Q1.A1 AND Q1.A3) OR NOT Q2.A3, meaning if either both answer 1 and answer 3 are selected in question 1 or answer 3 is not selected in question 2.
Logic with question answers
It is possible to create logic rules based on the answer values comparison of two different questions. You can compare:
Type of comparison | Operator | Formula | Example |
fields of general format | equal(s) to, do(es) not equal to | Qx.Ay==[Qz.At ], Qx.Ay<>[Qz.At ] | Show Q4 if Q1.A1==[Q2.A1] |
fields with a date or number formatting applied | equal(s) to, do(es) not equal to | Qx.Ay==[Qz.At ], Qx.Ay<>[Qz.At ] | Show Q6.A3 if Q3.A3==[Q4.A1] |
fields with constants | equal(s) to, do(es) not equal to | Qx.Ay==n, Qx.Ay<>n | Hide Q11.A2 if Q9.A9==20 |
Logic with text values
When setting up logical conditions with text responses in the question of these types: Single Line Text, Multi-line text, Numeric Allocation, Dropdown fields of the Matrix, Comments field in Pick one with Comments, use the following available operators:
Operator | Description | Example | |
Logic Expression | Results | ||
== | If text responses contain the exact line string indicated next to '==', then the logic transition is fulfilled. This operator can also be used to refer to the record within the dropdown box of the '3D Matrix' type of question in the Qx.Ay.Cz==N format, where N is the sequence number of the item within the dropdown box that is selected by the respondent. Please note that enumeration, in this case, starts from 0, so if you need to refer to the 1st answer in the 3D Matrix dropdown, use Qx.Ay.Cz==0 condition; to the 2nd - Qx.Ay.Cz==1 and so on. | Q1.A2==Cat |
|
<> | If text responses do not contain the exact line string indicated next to '<>', then the logic transition is fulfilled. | Q2.A3<>Cat | Big Cat |
==LIKE | If text responses contain the line string indicated next to '==LIKE' regardless of its position in the text responses, then the logic transition is fulfilled. | Q2.A3==LIKECat | Cat |
<>LIKE | If text responses do not contain the line string indicated next to '<>LIKE' regardless of its position in the text responses, then the logic transition is fulfilled. | Q2.A3<>LIKECat |
|
==RLIKE | If text responses contain the line string specified by regular expressions next to '==RLIKE' regardless of its position in the text responses, then the logic transition is fulfilled. | ==RLIKERed(\s|\w)+Cross |
|
<>RLIKE | If text responses do not contain the line string specified by regular expressions next to '<>RLIKE' regardless of its position in the text responses, then the logic transition is fulfilled. | <>RLIKERed(\s|\w)+Cross | Red Bull |
==RMATCHES | ==RMATCHESxxx is the same as ==RLIKE^xxx$ | Q1.A1==RMATCHESRed(\s|\w)+Cross | Red fine Cross |
<>RMATCHES | <>RMATCHESxxx is the same as <>RLIKE^xxx$ | Q1.A1<>RMATCHESRed(\s|\w)+Cross |
|