Professional > Interview scripting > Writing interview scripts > Quota control scripting > Pending quota cells
 
Pending quota cells
When an interview belongs in a particular quota cell, you should increment the count of interviews pending (that is, in progress) for that cell. This signals to the quota control system that there is an interview running that may contribute to meeting the target for that cell. If you have quotas set up for multiple choice response lists, the quota control system normally pends all cells that correspond to the answers chosen from the list, but you can specify that only certain cells are pended if you prefer (see Prioritizing quota cells for multiple choice answers for details).
To increment pending counts, type the following statement in the routing section of the script at the point you want to update the counts:
Result = QuotaEngine.QuotaGroups["QuotaName"].Pend()
where:
Result is the name of a variable whose value will indicate the outcome of the pend request. The variable may be a question variable that you define in the metadata section of the script, or a temporary variable defined in the routing section.
QuotaName is the name of the quota whose pending counts are to be incremented. Often the quota name will be the same as the name of the question to which the quota belongs.
The outcome of a pend request is returned as one or more of the following flags:
Flag
Description
qrWasPended
The quota was pended.
qrOverTarget
The count of completed interviews exceeds the target.
qrBelowTarget
The count of completed interviews is below the target.
qrPendingOverTarget
The sum of pended and completed interviews exceeds the target.
For example:
RegionPendResult = QuotaEngine.QuotaGroups["Region"].Pend()
checks the Region quota and pends the count for the cell that corresponds to the region in which the respondent lives. If the action of pending the quota cell is successful, the value of RegionPendResult will include the qrWasPended flag. If it is not (the target may have been met already), RegionPendResult will not include this flag.
The next step is to test the result of your request and specify what you want to happen next. If the quota was pended, you'll usually want to ask some more questions. If the quota could not be pended, you may want to terminate the interview or skip to a different section of the questionnaire. To test the result of a pend request, type:
If (IsSet(Result, QuotaResultConstants.qrWasPended)) Then
  ... Actions
End If
For example:
Dim RegionPendResult
RegionPendResult = QuotaEngine.QuotaGroups["Region"].Pend()
If (IsSet(RegionPendResult, QuotaResultConstants.qrWasPended)) Then
Age.Ask()
Gender.Ask()
Else
Full.Show()
End If
An alternative to writing two separate statements to pend the quota and test the result is to write:
If (IsSet(QuotaEngine.QuotaGroups["QuotaName"].Pend(),
QuotaResultConstants.qrWasPended)) Then
See also
Quota control scripting