Jumping to a named location in the routing script
In long or complicated routing sections it can be helpful to organize the code into named sections. Named sections can be a useful alternative to long If...Then...Else statements with complex expressions, because you can simply place all the statements that apply to one group of respondents in a named section and then jump direct to the sections that apply to the current respondent. Although the effect on the interview is the same, you might find that using named sections makes the script easier to follow because each section stands alone rather than being part of a larger statement.
To name a section in the routing section, type the name on a line by itself and follow the name with a colon:
<section_name>:
On the next lines, type the statements that belong in that section (you can indent these statements to highlight the fact that they are part of a section. The section extends until the next section name is reached, or until the end of the routing section. For example:
Terminate:
IOM.Banners.Remove("IntroBanner")
TerminateText.Show()
Exit
The GoTo keyword jumps to a named location in the routing section of an interview script. You'll often use it when you want to skip a question or set of questions that do not apply to the current respondent.
To specify a jump (or skip), type:
GoTo <location>
where <location> is a location name in the script.
You can use GoTo as a statement by itself, in which case it applies to every interview that reaches the GoTo statement, but you are more likely to use it as part of an If statement when you want to ask some questions of certain respondents only. Respondents who should not see the questions will be sent past them with a GoTo statement. The following example sends people who are railway workers straight to the end of the script because they are not eligible to be interviewed.
If (RailwayWorker = {Yes}) Then GoTo Terminate
Normally, you jump forwards in the script, but backward jumps are also permitted. However, if you jump backwards in the script, make certain that you are not creating an infinite loop, where you are continually repeating the same set of statements. The interviewing program has a mechanism for dealing with infinite loops, but it is better to avoid creating them in the first place.
See also