Desktop User Guides > Professional > Interview scripting > Sample management > Sample management facilities > Quotas > How to write a quota control system > Pending quota cells
 
Pending quota cells
If you have quotas based on sample management data that you need to check before the interview starts, place statements such as the following inAuthenticateSampleRec once you have rejected everyone who has failed authentication for any reason not associated with quota control:
' Pend all relevant quota cells for this respondent
Result=QuotaEngine.Pend()

' Respondent does not belong in any quota cell or
' the target for one or more of the quota cells for
' this respondent has been met.
If (Result And QUOTA_RESULT_WasPended) >< QUOTA_RESULT_WasPended Then
QuotaEngine.Rollback()
  InterviewProperties("DisplayText").Value = "Thank you " &_
    "for you interest in our survey, but this survey is" &_
    "closed for people with your characteristics."
  LogMsg = LogStart & "Failed quota control, Not pended."
  Log.LogThisEx 21, LogMsg, LOGLEVEL_INFO
  ' Move sample record into a different queue
  Queues.MoveSampleRec "SM_REJECTED", SampleRec
  ' Release sample record from quota control
  Set SampleRec = Nothing
  ' Authentication fails so reject respondent from survey
  AuthenticateSampleRec=REJECT
End If
This example checks all quotas that exist in the quota database and, as long as none of the targets has been met, pends all the cells that the respondent belongs to. It does not matter that data might not be available for all quotas yet (there might be quotas associated with script data, for example), the quota control system simply ignores cells for which there is no data. Also, it does not matter if some of the sample data is used in quotas in the questionnaire script. After a cell has been pended for a respondent, it is not pended again, so there is no chance of having falsely inflated pending counts due to respondents being pended twice.
If the respondent fails quota control, an explanatory message is defined for the authentication-reject page and a message is written to the log file. Then the record is filed in the SM_REJECTED queue and released from quota control. Finally, the respondent fails authentication and the message defined earlier is displayed in their browser window.
For further information about QuotaEngine.Pend and QuotaEngine.Rollback see Quota Object model.
See also
How to write a quota control system