Branching from matrix question using custom scripting

Consider the following Matrix question:

Scenario: You ask respondents to rate there satisfaction level for Product, Support and Service. If respondents give a low rating of 1 or 2 then they should be asked to comment why they gave a low rating.

The script for the above requirement is as follows:


#if (${Q2_1} == 1 || ${Q2_1} == 2)
    $survey.branchTo("Q3")
#end

#if (${Q2_2} == 1 || ${Q2_2} == 2)
    $survey.branchTo("Q4")
#end

#if (${Q2_3} == 1 || ${Q2_3} == 2)
    $survey.branchTo("Q5")
#end

Here: Q2 is the question code for the Matrix Question. The questions in a matrix are referenced in the following way: Q2_1 for the first question in the matrix. Q2_2 for the second and so on. The first statement checks if Q2_1 is scored as 1 or 2, if true then branching is set to Q3. Similarly the second and third if statement checks if the second question and the third question were scored as 1 or 2 and branch to the corresponding questions if true.

Following are the steps for setting this up:

  1. Set up the survey with all the questions.
  2. After Q2, add a page break.
  3. Add the Custom Scripting question after Q2. Be sure to check the boxes for Enable Auto-submit and Logic Includes Branching.
  4. Enter the above script.
  5. Using the built-in branching option, set up Default Destination branching for Q3 to branch to Q4 and for Q5 to branch to Q6. Here, Q6 is the question code for
  6. respondents to continue with the rest of the survey.

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