Branching from Matrix type question using Custom Scripting

Consider the following Matrix question:

1. Screenshot

Survey Software Help Image

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:

Set up the basic survey with all the questions

Add the Custom Scripting/Scoring logic question after Q2 in the Survey

Set up the above Script in the Logic Question

Using the built in branching option set up default Branching for Q3, Q4 and Q5 to Q6. Here Q6 is the question code for the question with which the Survey should continue with.

Make sure there is a page break on Q2

Start your Free Trial