Desktop User Guides > Professional > Interview scripting > Writing interview scripts > Quota control scripting > Checking for empty or unfilled cells > Comparing the sum of pended plus completed interviews against the target
Comparing the sum of pended plus completed interviews against the target
This topic shows how to use IsBelowQuota to check for cells where the sum of pended and completed interviews is below the target. This type of test ensures that any interview that starts and completes will not cause the target to be exceeded. Of course, if you are allowing cells to go over target you can just compare the number of completes against the target.
IsBelowQuota is a function that returns True or False, so you generally use it in an assignment statement or in an If statement. Its syntax is:
GroupName is the name of the quota question.
CellNumber is the number of the quota cell to be tested. Cells are initially numbered sequentially from 1 according to the order of responses in the question’s response list, but if you later insert additional responses in the response list, the cell numbers for those quotas will be whatever is the next free number in the sequence. For example, if you insert a response as the third item in a list of five responses, the quota for that response will be found in cell 6. You can check cell numbers by looking at the project’s QUOTA_Target table.
Here is an example that shows how to check which age groups are available before asking the interviewer to find a respondent in a suitable age group. The metadata for this example is:
WomanAge "INTERVIEWER: Ask to speak to someone in one of the following
categories and select the appropriate category from the list."
categorical [1..1]
FU21 "Woman under 21",
F21to30 "Woman 21 to 30",
F31to49 "Woman 31 to 49",
F50Plus "Woman 50 or older",
None "No one available (DO NOT READ)"
NoneAvail "Unfortunately, there is no one in your household who is in
the categories I need for this interview. Thank you for your time.
Goodbye." info;
AllFull "All our interviewing targets have been met. I'm sorry to have
troubled you." info;
The routing code for this example is mainly concerned with testing the current state of the quota cells and generating a response list that contains only those participant categories with unfilled quotas. It also terminates interviews when all targets have been met or when there is no one in the household in any of the unfilled cells.
Dim Cat, ThisCell
ThisCell = 0
For Each Cat in WomanAge.DefinedCategories()
If Not QuotaEngine.QuotaGroups["WomanAge"].Quotas[ThisCell].IsBelowQuota Then
WomanAge.Categories = WomanAge.Categories - Cat
End If
ThisCell = ThisCell +1
' All targets have been met and only "None" is available
If WomanAge.Categories.Count = 1 Then
IOM.Texts.InterviewStopped = AllFull
End If
' No one available in unfilled cells
If WomanAge = {None} Then
IOM.Texts.InterviewStopped= NoneAvail
End If
The key steps in the routing are as follows:
1 Set the display filter for WomanAge to all categories in the response list on the assumption that all cells will have unfilled quotas.
2 For each category in turn, check whether the target for that category has been met. If so, delete that category from the list of possible answers because no more interviews are required with participants in this group.
3 At the end of the loop, the response list for WomanAge will contain only those categories with unfilled quotas. If there are none (apart from “None” for which there is no quota), issue an appropriate message and terminate the interview, flagging it as terminated due to quota control.
4 The interviewer is instructed to speak to a participant in one of the unfilled quota cells. If there is no one available in any of these categories, the interviewer selects “No one available”. The interview is terminated due to quota control and a message explaining this is displayed for the interviewer to read out.
5 If a suitable participant is available, the pend count for that quota cell is incremented and the interview continues.
Although this method reduces the number of interviews that will fail due to full quotas, it is not foolproof. When quotas are very close to being filled and many interviews are running concurrently, it is possible for a quota to be unfilled when an interview starts but to be filled by the time the pend request is executed.
This example works even if you insert additional responses in the middle of the list once interviewing has started (unlikely in this particular example, but possible if the quota controlled list was a brand or product list). When the quota tables are created, each quota cell is given a unique ID starting at 1. If you later add extra responses, these responses are inserted in the quota tables at the point they appear in the response list but they are given the next free quota ID in the list. So, for example, inserting an extra response in the third position of a five-response list will show that response at the fourth position in the quota table but its ID will be 6.
See also
Checking for empty or unfilled cells