How to: Substitutions logic


Substitutions can be used to personalise the survey experience for respondents by injecting specific text into questions and answer choices, define groups of respondents, and introduce 'Exit' criteria for your survey (see How To – Exit Logic document).

Setting up a substitution

As an example, let us say that you have asked a respondent if they are responding as an organisation or a business, and in a subsequent question you want to ask 'What is the name of your [either organisation or business]' based on the answer they have given:

  1. Navigate to the Substitutions tab of the Edit Survey page.
  2. Select [Add group or substitution] and name your substitution. You can choose whatever name you wish, as an example let us call this one 'organisation-business'. Do not leave any spaces in this name – you can see in this example words have been separated with a hyphen. Leave the default blank.
  3. Select [+logic] to load the familiar logic editor. Add your logic as usual, choosing the words you would like to substitute into your questions.

    Substitutions logic 2

Words will be substituted exactly as they appear. If you sometimes need them to appear with a capital letter, set up a separate substitution for this.

Using substitutions in the question editor

As with any other logic, when using substitutions you must ensure that the question on which the logic depends appears in a previous section. It is also advisable to make this question required. Then, simply add your substitution name between {{ }} in the place that you would like it to appear.

Substitutions logic 4

Using the Default value

In some instances, it will be necessary or more efficient to use the default value in your logic. The default value is used unless logic dictates otherwise.

A notable example is when applying substitution logic to "open" questions (i.e. questions with an "other" option). Below is an example which asks about mode of transport, with a following question asking about travel time. There are several choices as well as an "other" choice. Substitutions logic 5

Set up the substitution logic as before to deal with the set choices. In the case where "other" is selected, the default substitution will be used. For this example the word 'travel' would be appropriate. We can then insert our substitution as before.

Substitutions logic 7

Another notable use for the default substitution is for making your logic simpler. Below we ask about respondent's feeling about their travel time. On this occasion we will use only two substitutions.

Substitutions logic 12

Substitutions logic 13

In this instance, we can use just one logic line to set the text for "over 60 minutes". In all other cases (i.e. when the answer does not equal "over 60 minutes") the substitution will use the default value. This saves using four separate lines of logic for the other choices. We can then insert our substitution as before.

Substituting answers from previous questions

We can also substitute the text from previous answer choices into the survey. For example using a respondent's name to personalise the experience.

To do this we make use of the "question id" number. In the below example there is a question asking for the department a respondent works in.

Substitutions logic 15

In this example, we would like to ask respondents what they most enjoy about working in their department.

  1. Select [copy id] of the source question to copy the question id onto the clipboard. Paste the id into the following question and wrap in braces "{{ }}".
  2. The following question will now display the department chosen by the respondent.

Note: If the source question is 'coded', such as a Multi-choice coded question, add "-answer" to the end of that question id. This ensures that the choice is "de-coded" for the respondent to read. Non-coded questions such as short and long text question types, the phrase "-answer" is not required.

This type of substitution can be used in question text, answer choices, prompt text, instruction text and respondent emails.

Last updated: March 28, 2024
Errors, omissions, or comments? Let us know!