|
Sample survey
This conditional transition means that the next question asked to respondents depends on their answer to this particular question or to the previous question(s) as well. Logic expression includes conditions combined and grouped in different ways. Logic conditions check if particular answers in the questions have been selected.
This logic transition is used to make flexible survey structures that allow users to dynamically organize their surveys. For example, a female vegetarian of 25-35 years will never get a question like this: "Which meat dishes do you prefer?".
To add an "Advanced Logic" transition to one of the questions in your survey click [Logic] next to the question on the 'Edit Questions' page, and then:
- Select he Advanced Logic option to apply this logical transition to the question if allowed.
- Create a new logic rule:
- Click Add New to enter a logic expression in the text box and select a question to go to if this condition is fulfilled.
- Click Save to add a new logic rule.
- Click Cancel to cancel the settings.
- Manage logic rules:
- Click Edit to edit your logic rule.
- Click Delete delete your logic rule.
- Use up and down arrow buttons to move your logic rules. Note that logic rules are processed top-down, so those with higher priority should be moved topmost. For example there are two logic rules: 1) if Q1.A4 => Q12 (if respondents select answer 4 in question 1 they go to question 12), 2) if Q1 => Q14 (if respondents select any answer in the question 1 they go to question 14). If the second rule is topmost and its condition is fulfilled respondents will go to question 14 at once, so the first rule will never work.
You can create as many logic expressions as you need and then turn them on or off depending on the current needs and requirements. For that use the Activate and Deactivate buttons next to the appropriate expressions.
Logic expression format:
To compose a logic expression that checks up if particular questions and answers have been selected follow this format:
- Q1 checks up if any answer has been selected in question 1.
- Q10.A3 checks up if answer 3 has been selected in question 10.
- Q5.A2.C3 checks up if answer 2 has been rated in column 3 in question 5.
(question type: 'Rate Different Items Along the Scale of Your Choice').
- Q7.C5 checks up if any answer has been selected in column 5 in question 7.
(question type: 'Rate Different Items Along the Scale of Your Choice').
Combining and Grouping
You can combine logic conditions using AND, OR and NOT operators as well as group them with parentheses ().
Logic operators:
- Operator AND denotes that all the combined logic conditions are fulfilled.
For example: if Q1.A1 AND Q1.A3 => Q4. It means that you will go to question 4 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 fulfilled.
For example: if Q1.A1 OR Q1.A3 => Q4. It means that you will go to question 4 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. For example: if NOT Q1.A1 => Q4. It means that you will go to question 4
if answer 1 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. For example: if (Q1.A1 AND Q1.A3) OR NOT Q2.A3 => Q4.
It means that you will go to question 4 if either both answer 1 and answer 3 are selected in question 1
or answer 3 is not selected in question 2.
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) |
Conventional statements in alert messages
| Statements |
Examples |
<EOF> (= end of logic expression)
<OPERAND> (= logic condition) |
Q1.A2 AND - here the end of logic expression was encountered however logic condition (for example, Q1.A3) was expected. |
Advanced Logic with text responses:
You can apply Advanced Logic to text responses in the question of these types: 'Single line text with pre-format options', 'Multi-line text response' and 'Numeric Allocation' as well as to Dropdown fields of the '3D Matrix' type of question. List of available operators is shown below.
| Operator |
Description |
Example |
| Logic Expression |
Results |
| == |
If text responses contain the exact line string indicated next to '==', then 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 respondent. |
Q1.A2==Cat |
Cat Flower
Big Cat
Cathlene
Cat |
| <> |
If text responses do not contain the exact line string indicated next to '<>', then 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 not selected by respondent. |
Q2.A3<>Cat |
Cat Flower
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 logic transition is fulfilled. |
Q2.A3==LIKECat |
Cat Flower
Big Cat
Cathlene
Cat
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 logic transition is fulfilled. |
Q2.A3<>LIKECat |
Cat Flower
Big Cat
Cathlene
Cat
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 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 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 |
Note
- Logic expressions are case-sensitive. You must use only java syntax working with regular expressions.
- The complex expressions with operators LIKE, MATCHES require space after themselves in order to indicate the phrase completion.
For example,
Q1.A2==RLIKERed(\d+)Cross\1 AND Q1.A3 - is valid expression.
Q1.A2==RLIKERed(\d+)Cross\1AND Q1.A3 - is not valid expression, as it misses the space after \1.
- Insert space between braces and logical expressions. For example:
Incorrect: (Q1.A1==LIKECat OR Q1.A1==LIKEDog) AND Q1.A2==LIKEBat
Correct: ( Q1.A1==LIKECat OR Q1.A1==LIKEDog ) AND Q1.A2==LIKEBat
- When using the <>LIKE and <>RLIKE operators for complex expressions OR and AND
operators will be inverted due to the double negation. For example:
( Q1.A1<>LIKECat OR Q1.A1<>LIKEDog ) - the answer with both Cat and Dog text response will satisfy the expression.
If only Cat or only Dog appears to be a text response, logical expression will not be satisfied.
( Q1.A1<>LIKECat AND Q1.A1<>LIKEDog ) - the answer with both Cat and Dog text response will not satisfy the expression.
If only Cat or only Dog appears to be a text response, logical expression will be satisfied.
Additional Information:
- This is a powerful feature but you should be careful as you use it.
- Keep in mind that the questions where you have applied 'Advanced logic' must come before the questions selected to follow them.
- Logic should be the last thing applied to a question. If you modify the question in any way, make sure that your logic rules work properly.
- Autocomplete function allows you faster and easier enter logic expressions. After entering Q, Qx.A or Qx.Ay.C system will show you the list of available questions, answer options or answer columns (for 'Rate' and '3D Matrix' questions) accordingly. Picked element will be substituted by its sequence number within the survey.
|