branchTo

Description

This function will help you to modify the flow of the survey for the respondent by apply branching logic via velocity script.


Syntax

$survey.branchTo("Question Code")


Example Script

Consider a scenario where you want to alter the flow of the survey based on the answer options selected in Q1 of the survey. If respondent select answer option 1 in Q1 then redirect to Q3 and if answer option 2 is selected redirect the user to Q4 and so on.

arrow_rightScript

                    # if (${Q1} == 1 )
           $survey.branchTo("Q3")
          # end
          # if (${Q1} == 2)
           $survey.branchTo("Q4")
          # end
          # if (${Q1} == 3)
           $survey.branchTo("Q5")
          # end
          # if (${Q1} == 4)
           $survey.branchTo("Q6")
          # end


                   

Need help? Contact Us