Custom Scripting based piping - How to?

How to Pipe Text over multiple pages?

Example 1:

Q1 Which sport do you play the most?

 Baseball
 Rugby
 Soccer
 Basketball
 Other __________
 
In the above example, you wish to ask respondents subsequent questions based on the sport they play. The in-built piping option will only work on the next immediate page. Also you cannot automatically pipe the text entered if other option is choosen. To set up the above Survey you will need to use Custom Scoring/Logic Script type question. For this you will need to update the Custom Variable 1 with the Sport and you can then base the branching on the selection and also use the text anywhere in the Survey.

The script for the above requirement is as follows:

#if (${Q1} == 1)
      $survey.updateCustom1("Baseball")
      $survey.branchTo("Q2")
#end

#if (${Q1} == 2)
      $survey.updateCustom1("Rugby")
      $survey.branchTo("Q2")
#end

#if (${Q1} == 3)
      $survey.updateCustom1("Soccer")
      $survey.branchTo("Q2")
#end

#if (${Q1} == 4)
      $survey.updateCustom1("Basketball")
      $survey.branchTo("Q2")
#end

#if (${Q1} == 5)
      $survey.updateCustom1("${Q1_OTHER}")
      $survey.branchTo("Q2")
#end
 
In the above script we check which option is selected for Q1 and depending on that we update the Custom1 variable with the correct text. If option 5 that is the Other option is selected then the Custom1 variable will get updated with the user input text. To reference the text entered for the Other option we use: "QuestionCode_OTHER" so in the above example QuestionCode is Q1 so we reference the User entered text using Q1_OTHER. We are also branching to the next question which is Q2 for each selection. If required we can branch to different questions based on the selection. You can use ${custom1} to replace the value stored in Custom1 variable. Once updated the Custom1 value can be used anywhere on the survey.

Following are the steps for setting this up:

Setup the basic survey with all the questions

Wherever you wish to replace the text for the sport which the user/respondent selected use ${custom1}.

After Q1 add a Custom Scoring/Logic Script type question and enter the above script.

Make sure there is a page break on Q1

Start your Free Trial