Branching based on open-ended questions using custom scripting

Example 1: You ask respondents which restaurant they like to go for dinner using a text input question and, subsequently, you wish to ask them questions related to the restaurant they entered.

The Script for this would be as follows:

Here Q1 is the Question Code for the Open Ended / Text input type question. And we reference the value by Q1_1 which is the first text box/field for the Question (There can be multiple text boxes for a single question. Q2 is the next question in sequence. When respondents enter the name of the Restaurant it is saved in Q1_1. Custom Variable 1: Custom1 is updated with this value and now can be used anywhere in the rest of the Survey.

Directions for setting up the Survey:

  • Setup the basic survey with all the questions
  • In the first question Q1 ask the respondents to entere the Restaurant of their choice. In the rest of the survey, wherever you wish to use the text entered use ${custom1} and enable Dynamic Replacement for the questions.
  • After Q1 add a Custom Scoring/Logic Script type question and enter the above script.
  • Make sure there is a page break on Q1

Example 2:

Q2 How many times do you visit Tacano's every month? Now you ask respondents how many times they go to a certain Restaurant each month and depending on that you wish to branch respondents to followup questions. Now if respondents enter 0 if they do not go to that restaurant then there is no point in asking the subsequent questions. See the below given script to see how to set this up.

The Script is as follows:

#if (${Q2_1} == "0")

#if (${Q1_1} != "0")
The above Script checks if the user input is 0. If the user enters 0 they are branched to the next questions starting with QuestionCode NewBlock. If the user entered value is not 0 then they are branched to Q3 and asked followup questions.

License & Access Options

This feature/tools described here are available with the following license(s) :

Team Edition

Unlimited Surveys, Questions

Advanced Toolset and Features

No Long Term Commitment

Was this article helpful?
Sorry about that
How can we improve it?