Branching based on Open Ended / Text Input type Questions

Example 1: You ask respondents which Restaurant they like to go for dinner and subsequently you wish to ask them questions related to the Restaurant of their choice.

The Script for this would be as follows:
      $survey.updateCustom1("${Q1_1}")
      $survey.branchTo("Q2")
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")
  $survey.branchTo("NewBlock")
#end

#if (${Q1_1} != "0")
  $survey.branchTo("Q3")
#end
  
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.