Professional > Interview scripting > Writing interview scripts > Quota control scripting > Checking for empty or unfilled cells > Comparing the number of completes against the target
 
Comparing the number of completes against the target
If you want to ignore pended interviews when checking quotas, you can compare each cell’s count of completed interviews against the target. This may mean that you end up exceeding targets in some cases if two interviews are running concurrently for the same quota cell and only one interview is required to achieve the target. For this to work, the Allow OverQuota option must be switched on. You can do this when you define quotas (see Defining table quotas) or at any time during the course of the project.
To check the completed count, type:
QuotaEngine.QuotaGroups["GroupName"].Quotas[CellNumber].Completed
in the routing section, where:
GroupName is the name of the quota question.
CellNumber is the number of the quota cell to be tested. Cells are numbered sequentially from 1 and their order corresponds to the order of responses in the question’s response list.
Here’s 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 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 is:
Dim Cat, ThisCell
ThisCell = 0
WomanAge.Categories = WomanAge.DefinedCategories()
For Each Cat in WomanAge.DefinedCategories()
If QuotaEngine.QuotaGroups["WomanAge"].Quotas[ThisCell].Completed >= _
QuotaEngine.QuotaGroups["WomanAge"].Quotas[ThisCell].Target Then
WomanAge.Categories = WomanAge.Categories - Cat
End If
ThisCell = ThisCell+1
Next
' All targets have been met and only "None" is available
If WomanAge.Categories.Count = 1 Then
IOM.Texts.InterviewStopped = AllFull
IOM.Terminate(Signals.sigOverQuota)
End If
WomanAge.Ask()
' No one available in unfilled cells
If WomanAge = {None} Then
IOM.Texts.InterviewStopped= NoneAvail
IOM.Terminate(Signals.sigOverQuota)
Else
QuotaEngine.QuotaGroups["WomanAge"].Pend()
End If
See also
Checking for empty or unfilled cells