Professional > Interview scripting > Writing interview scripts > Other flow control statements > Terminating the interview
 
Terminating the interview
You can terminate an interview at any time by placing an Exit statement in the routing section of the script. If the project uses Sample Management, this causes the sample record to be returned to the Sample Management system for processing, as normally happens when an interview ends because the end of the script has been reached.
Ending an interview with Exit can be somewhat abrupt if you do not display an explanation of why the interview is being terminated. Here is an example that displays a brief closing message before terminating the interview when respondents do not satisfy the screening criteria. Respondents who pass the screening criteria continue with the main part of the interview. The metadata section defining the screening questions is as follows:
Intro "Hello, I'm calling from The Train Company. I wonder if you
  can spare some time to answer a few questions about train
  travel." info;
TerminateText "Thank you for your help, but your household does
  not meet the requirements for this survey." info;

Callback "INTERVIEWER: Arrange an appointment to call back and speak to this person." info;

RailwayWorker "Do you work on the railways?
  Is anyone in your immediate family associated with this field?"
  categorical [1..1]
{
Yes, No
} NoCaseData;
UsesTrain "Do you travel regularly by train / may I speak with someone who regularly travels by train?" categorical [1..1]
{
RegularTraveler "Respondent travels regularly by train",
NoTrainTraveler "No one travels regularly by train",
TrainUserNA "Regular train traveler not available"
} NoCaseData;
LastTwoWeeks " Have you traveled by train during the last two weeks?"
categorical [1..1]
{
Yes, No
} NoCaseData;
JourneyReason "What was the main reason for your journey?"
categorical [1..1]
{Business, Pleasure};
Notice how the screening questions have been flagged with NoCaseData because the data is of no use to the survey.
The routing section that filters out unsuitable respondents is as follows:
IOM.Banners.Add("IntroBanner",Intro.Label)
RailwayWorker.Ask()
If (RailwayWorker = {Yes}) Then GoTo Terminate
UsesTrain.Ask()
If (UsesTrain = {TrainUserNA}) Then GoTo Callback
If (UsesTrain = {NoTrainTraveler}) Then GoTo Terminate
LastTwoWeeks.Ask()
If (LastTwoWeeks = {No}) Then GoTo Terminate

' Questions for train travellers
IOM.Banners.Remove("IntroBanner")
JourneyReason.Ask()
Exit

Callback:
IOM.Banners.Remove("IntroBanner")
Callback.Show()
Exit

Terminate:
IOM.Banners.Remove("IntroBanner")
TerminateText.Show()
Exit
This script deals with three types of respondent.
Those who work for the railway or who have close relatives that work for the railway are ineligible for the survey so their interview is terminated straight away.
Having established that the household is suitable, the script then guides the interviewer to finding a suitable respondent within the household. Although the script does not specifically do this, the implication is that if the first respondent is not a regular train traveler, the interviewer will automatically ask to speak to someone who is. Once all possibilities have been exhausted, the interviewer enters an answer to UsesTrain.
If there is no one at all who travels by train, the interview is terminated. If there is a regular train traveler but this person is not available, the interviewer is asked to make an appointment. The interviewer does this by selecting the appropriate option from the call results menu. There is no need for the script to terminate the interview because this happens automatically when the interviewer makes the appointment.
If the respondent travels regularly by train but has not done so within the last two weeks, the interview is also terminated. After this, only people who travel regularly by train and who have done so in the two weeks are left to start the main part of the interview.
See also
Other flow control statements