You can use display logic to create surveys that are customized to each respondent.
This was already possible at the page level and now you can go much further. When a specific question, sub-question or answer choice pertains only to certain respondents, you can hide it conditionally, based on previous answers or metadata. Through this low level 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:
{{eq 1 1}}
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:
{{eq 1 2}}
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:
{{eq respondent.questions.children_count 0}}
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?
Leave a Reply