You can use display logic to create surveys that are customized to each respondent. When a specific question or answer choice pertains only to certain respondents, you can hide it conditionally, based on previous answers or metadata. Through display logic, you can create surveys that dynamically adapt to your respondents’ answers and custom fields.
CSL conditions
The display logic is set using CSL. A CSL condition is a statement that is either true or false.
Here is a simple example that will return true:
Translation: The ‘eq’ stands for ‘equals’. In CSL, the operator is always placed first. The other two items are what is being compared so it says ‘1 is equal to 1’. This is true.
Here is an example that will return false:
It says ‘1 is equal to 2’. This is false.
CSL conditions can be used in logical operators like ‘if’ statements and they can be used in question display logic.
For example, in question one, respondents are asked how many children they have. Later you have a checkboxes question asking about favorite things to do on the weekend. One of the answer choices is ‘Taking kids to the park‘. You would not want to show that answer choice for respondents that don’t have children. So you would set the display logic for that answer choice to be ‘Hide if‘ and use the following CSL condition:
Translation: The ‘eq’ stands for ‘equals’. You could use other operators here too, like ‘gt’ (greater than). The variable in the middle refers to the children count question using its data label. So it says: Is the answer the respondent gave to the children count question equal to 0?
Steps
- Click on the dropdown next to the question.
- Click on Edit.
- Click on the Display Logic tab.
Depending on the question type, you can set the logic for the entire question, sub-questions and answer choices. - Look for the item you would like to conditionally hide and select Hide if.
- In the textbox that appears, enter or paste the CSL condition that you would like to use to determine if the item should be hidden.
If the condition is true, then the item will not be shown to the respondent. If the condition is false or invalid, the item will be shown.

Examples
If you select Hide if in the dropdowns on the display logic tab, you can use these example conditions to get started. See our CSL page for more operators. See our CSL survey variables page for a list of variables that you can use.
CONDITION | DESCRIPTION |
---|---|
|
Respondent selected answer choice 1 in the question with the data label ‘myLabel’. |
|
Respondent selected answer choice 1 in the first sub-question. |
|
Respondent did NOT select answer choice 1. The NOT reverses the result. So if something is true, adding a not in front makes it false. |
|
20 or more respondents selected answer choice 3. |
|
Combine multiple conditions using and (All terms must be true). |
|
Combine multiple conditions using or (At least one of the terms must be true). |
|
When using a ‘not’, each term is evaluated to true or false and then finally reversed so that rule becomes false and false becomes true. |
Looking at the last ‘not’ example above, let’s assume for example, the respondent answers choice 7. Simplified, the code can then be seen as:
The or is true since the respondent answered one of the two answer choices, so you get:
‘Not’ makes the true become false:
Comments
0 comments
Please sign in to leave a comment.