Skip to main content
Skip table of contents

Set Value Logic

You can build complex logical conditions using Add rule (1), Add sub-group (2), 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:
( (Q1 AND Q3.A2) OR (Q5.A1 AND Q5.A3) ) AND (Q6.A2 OR Q6.A3

How to combine logic conditions 

When setting up a conditional part of you expressions, you can combine logic conditions using AND, OR and NOT operators as well as group them with parentheses ().

  • 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 may 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 ]

Set and clear Q4.A1 if Q1.A1==[Q2.A1]

fields with a date or number formatting applied

equal(s) to, do(es) not equal to
less than, less than or equal to
greater than, greater than or equal to

Qx.Ay==[Qz.At ], Qx.Ay<>[Qz.At ]
Qx.Ay<[Qz.At ], Qx.Ay<=[Qz.At ]
Qx.Ay>[Qz.At ], Qx.Ay>=[Qz.At ]

Set Q6.A3 if Q3.A3==[Q4.A1]
Clear Q10.A1 if Q5.A5<[Q6.A1]
Clear Q12.A1.C3 if Q7.A2>=[Q8.A1]

fields with constants

equal(s) to, do(es) not equal to
less than, less than or equal to
greater than, greater than or equal to

Qx.Ay==n, Qx.Ay<>n
Qx.Ay<n, Qx.Ay<=n
Qx.Ay>n, Qx.Ay>=n

Set Q15.A2 to 20 if Q9.A9==20
Clear Q4.A1 if Q11.A2<=545
Set and clear Q6.A8.C10 if Q15.A4>6

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

Flower
Big Cat
Cathlene
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
Cathlene
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
Big Cat
Cathlene
Beautiful Flower

<>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

Cat Flower
Big Cat
Cathlene
Beautiful Flower

==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

Red Bull
Cross Roads
Red fine 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
Cross Roads
Red fine Cross

==RMATCHES

==RMATCHESxxx is the same as ==RLIKE^xxx$

Q1.A1==RMATCHESRed(\s|\w)+Cross

Red fine Cross
Red fine Cross only

<>RMATCHES

<>RMATCHESxxx is the same as <>RLIKE^xxx$

Q1.A1<>RMATCHESRed(\s|\w)+Cross

Red fine Cross
Red fine Cross only

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.