How to set up Delayed Branching using Custom Scripting

Delayed branching is when you want to branch respondents to various locations in the survey based on questions asked earlier in the survey. For example, let’s say you ask respondents to select their gender in Q2, but you don’t want to branch respondents based on their answer to Q2 until after Q9, at which point Q10 should be shown to those who selected Male, and Q11 should be shown to those who selected Female. Then, everyone should go back to continue the survey with Q12. To do this, you can use custom scripting. The question for this example would be set up as follows:

Q2 Gender? Male Female

The script for the delayed branching requirement is as follows:
#if(${Q2} == 1)

#if(${Q2} == 2)

In the above script: Q2, Q10 and Q11 are question codes for the respective questions. The if statement checks if answer to Q1 was 1 (Male) or 2 (Female) and accordingly branches to Q10 or Q11

Following are the steps for setting this up:

  • Set up the basic survey with all the questions.
  • Add a page break after Q9.
  • Add a Custom Scripting question after Q9.
  • Enter the script as shown above.
  • Enable Auto Submit and check the box for Logic Includes Branching.
  • Set up default destination branching for Q10 and Q11 to go to Q12.


This feature is available with the following licenses:

Team and Enterprise

Was this article helpful?
Sorry about that
How can we improve it?