In a survey, you can add validations and conditions to questions in order to use responses to improve navigation or publish a quiz that requires answer validation and score attribution.
Syntax
A condition or validation always uses the same syntax composed of the following elements:
(property operator value)
(Q1.C2.Checked == 1)
Parentheses allow you, just like in a mathematical formula, to group criteria. In the following example, the condition or validation would be applied if choice 1 (C1) or (||) choice 2 (C2) of question 1 (Q1) has been selected and question 2 (Q2) is completed.
(Q1.C1.Checked == 1 || Q1.C2.Checked == 1) && (Q2.isCompleted == 1)
Data Types
Comparison value formats | |
| Boolean (true) | true |
| Boolean (false) | false |
| Text (general text format) | "abc" |
| Text (date format) | yyyy.mm.dd |
| Text (date and time format) | yyyy.mm.dd hh:mm:ss |
| Numeric (integer format) | 12345 |
| Numeric (decimal format) | 123.45 |
Boolean | |
|---|---|
| To indicate that the property... | use... |
| is true | property == true |
| is false | property == false |
Text | |
|---|---|
| To indicate that the property... | use... |
| is empty (null) | property is null |
| is not empty (not null) | property is not null |
| is equal to abc | property == "abc" |
| is not equal to abc | property != "abc" |
| contains abc | property contains "abc" |
| does not contain abc | property not contains "abc" |
| matches abc% (with wildcards) | property like "abc%" |
| does not match abc% (with wildcards) | property not like "abc%" |
Numeric | |
|---|---|
| To indicate that the property... | use... |
| is less than | property < "123" |
| is less than or equal to | property <= "123" |
| is greater than | property > "123" |
| is greater than or equal to | property >= "123" |
Possible combinations | |
|---|---|
| To... | use... |
| property1 and property2 | property1 && property2 |
| property1 or property2 | property1 || property2 |
| property1 added to property2 | property1 + property2 |
| property1 added to value | property1 + "123" |
| property1 subtracted from property2 | property1 - property2 |
| property1 subtracted from value | property1 - "123" |
| property1 multiplied by property2 | property1 * property2 |
| property1 multiplied by value | property1 * "123" |
| property1 divided by property2 | property1/property2 |
| property1 divided by value | property1/"123" |
| property1 and property2 or property3 | (property1 && property2) || property3 |
Validation Formulas and Conditions
Question (general) | |
|---|---|
| Property | Description |
| Qx.Error Boolean | Indicates whether the question contains an error. |
| Qx.isCompleted Boolean | Indicates whether the question has been completed. |
Text question or rating scale (radio buttons) | |
|---|---|
| Property | Description |
| Qx.Label Text | The label (text) of the question. |
| Qx.Value Text or Numeric | The value of the question. |
Single choice question (dropdown or radio button) | |
|---|---|
| Property | Description |
| Qx.Label | The label (text) of the question. |
| Qx.Value | The value of the question. |
| Qx.Cy.Label | The label of choice number "y". |
| Qx.Cy.Selected Boolean | Choice number "y" has been selected. |
| Qx.Cy.Value | The value of choice number "y". |
Multiple choice question (checkboxes) | |
|---|---|
| Property | Description |
| Qx.Label | The label (text) of the question. |
| Qx.Value | The value of the question. |
| Qx.Count | The number of selected choices. |
| Qx.Cy.Checked | Choice "y" has been checked. |
| Qx.Cy.Value | The value of choice number "y". |
| Qx.Cy.Label | The label of choice "y". |
Personalization (Piping)
Piping allows you to personalize the text of a question, a choice, or a row using the value of a previous response. For this to work, the reference must be on a page that comes before the page where the personalization element is used.
It can be used for: Question (Q), Validator (V), Page (P), and Parameter (E).
The syntax is as follows: [[P(Property)]]
| Example to display the value entered in question 1 You answered “[[P(Q1.Value)]]” to a previous question. Please indicate why. |
Properties | |
|---|---|
| Checked | Indicates whether a choice is selected. Applies to single or multiple choice questions. The command must contain the choice identifier. Example: Q1.C1.Checked |
| Count | Indicates the number of checked boxes. Can apply to a row, a choice, or the entire question. Mostly used for multiple choice questions. Example: Q1.R1.Count returns the number of checked boxes on row 1. |
| Error | Indicates whether a question contains an error (not useful in piping but useful elsewhere in the syntax). |
| isCompleted | Indicates whether a question has been completed. |
| isTrue | Indicates whether a validator evaluates to true. |
| Label | The label of the selected choice. |
| Selected | Same as Checked, but adapted for dropdown lists. |
| Value | The selected or entered value. |
| Text | The question text. |
| Description | Additional description of the question. |
| HelpText | The help text of the question. |
| isNA | For scale questions, indicates whether the “Not Available” option is selected. Note that isNA does not return a default value. |
Parameters
Parameters allow you to collect additional information about a respondent by passing information through the URL for a public/private survey, or transparently for a Dialog Insight Contact invitation survey. You can use parameters in question conditions.
Syntax: [[P(E1.Value)]], [[P(E2.Value)]]
E1 is the first parameter in display order in the Parameters tab.
The collected data will appear in the exported data. Columns in the file will correspond to each parameter (E1, E2, E3, etc.).
Example: E1.Value == 'Director' || E1.Value == 'President'