Determining The Order Of Sub-Chapters Execution

This "How-To" will guide you how to set the execution order of chapters in a survey.

Attached to this "how-to" you will find an example survey (file with an .srv extension) of how to perform this logic (and here is a an explanation of how to import it to your SurveyToGo Studio: How To Import A Survey )

General Logic of the example:

The survey contains of 4 sub-chapters which we would like to execute in one of 3 sequences according to the selection in Q1.
The 4 sub-chapters are under chapter 1 that is defined to iterate 4 times.

Since this logic of using multiple iterations, each to enter a different sub-chapter, it's creating quite a large data base - 4 iterations X 4 questions, for no need (especially if your survey has more than 4 questions as in the example) we would over-come it by using "static" structure of questions outside the loop (questions 8-11), to hold the answers given in the sub-chapters, and only the "static" structure will be exported.

General Logic of the Example:

1. Question 1: At the beginning of the survey, used to set the order of the 4 sub-chapters.

Note: In this example the order is set manually by selecting answer to question 1 so you can follow the survey's logic. But in your survey- you can use a script to set the answer to this question according the logic you wish to implement, and make it a dummy question if you don't want it visible.

2. Chapter 1: This is the loop chapter.

In the "Loops" tab it's defined to iterate 4 times (number of iterations= number of sub-chapters)

3. Question 2: an empty question that includes "ExecutionMgr.GotoNext()" in its start script. This is due to execution sequence needs and cannot be removed otherwise the example will not work.

4. Sub-chapters: In each sub-chapter in the "Rules" tab, in the "Chapter Execution Rule" pane use:

IterationIndex==Sub-chapter No.

5. Questions 8-11: Are the "static structure", these are questions used to hold the given answers in sub-chapters 1-4.

5.1 In each question's "end script" - SetAnswer() is used to set the answer to the corresponding question in the static structure.

5.2 These questions should be set as "Dummy"- since there is no need to show them during the interview. In the example they are not "Dummy" so you can see the answers are set accordingly.

6. Advanced script: The function "OnCreateIterationOrder" is used, this is a call back function that runs when a chapter with iterations is entered and determines the iteration order.
In our example when chapter 1 is entered the function sets the iteration order according to the answer of Q1.

7. Export: When exporting the results, we would export the "static structure", instead of chapter 1 (note Q1 is exported, so you can tell what was the execution order):


that's it!

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request



Please sign in to leave a comment.