Professional > Interview scripting > Writing interview scripts > Quota control scripting > Prioritizing quota cells for multiple choice answers > Pending one cell only using prioritization
 
Pending one cell only using prioritization
Here is a simple example that you can use for familiarizing yourself with the different methods of prioritization. It is designed to work with quotas where only one cell is pended per question.
The metadata for the script is:
Brands define
{
Alpine,
HelenB "Helen Bradley's",
DFresh "Dairy Fresh",
Kentish "Kentish Farm",
Finborough,
Alsace
};
IceCream "Which brands of ice cream do you buy?" categorical [1..]
{use Brands};
Flavor "Which are your favorite flavors in the {#PendedBrands} brand
of ice cream?" categorical [1..]
{
Chocolate, Mint,
Toffee "Toffee crunch",
Raspberry "Raspberry ripple",
Strawberry, Vanilla,
OtherFlavor "Other"
};
AllFull "All our interviewing targets have been met. I'm sorry to
have troubled you." info;
The routing code is:
IceCream.Ask()
Dim Pendresult, category, PendedBrands
' Pend cells as specified in the quota database
PendResult = QuotaEngine.QuotaGroups["IceCream"].Pend()
If (IsSet(PendResult, QuotaResultConstants.qrWasPended)) Then
' Cell was pended so find out which one it was
For Each category in IceCream.Categories
If (Find _
(QuotaEngine.QuotaGroups["IceCream"].Quotas.WasPendedList[0].Expression, _
"{" + category.Name + "}") >= 0) Then
PendedBrands = category.Label
End If
Next
Else
' No cells pended so terminate interview
IOM.Texts.InterviewStopped = AllFull.Label
IOM.Terminate(Signals.sigOverQuota)
End If
' Ask more about the pended brand
Flavor.Ask()
In this routing code, the first If statement tests whether a cell was pended. If so, we need to find the category (response) text so that it can be displayed in the text of the Flavor question. The For Each loop cycles through the responses in the IceCream response list and compares them with the text in the description of the pended quota cell.
In the Find statement, WasPendedList contains a flat list of the names of the quota cells that were pended. Numbering in this list starts at 0 so WasPendedList[0] refers to first (and in this example, only) quota cell pended. The Expression object contains the definition of the quota cell as it is stored in the quota database.
If a match is found between a category in the response list and a string in the description of the pended quota cell, the category name is saved for use in the rest of the script.
The Else section of the code deals with interviews where no quotas were open for pending. An explanatory text is set into the end of interview page and the interview is terminated.
The routing section ends by asking the respondent which flavor ice cream he or she likes best for the brand whose quota cell was pended.
Before you can run this script, set up the quotas as follows:
1 Use the Quota program or the Quota option in UNICOM Intelligence Professional to create a .mqd file. Set a target of, say, three interviews for each brand.
2 Activate the project and on the Quota tab select the option to create a new quota database.
3 Specify the number of brands you want to pend and the method of pending you want to use. Open the Quotas activity in UNICOM Intelligence Interviewer - Server Admin and select Prioritization in the drop-down Edit box. For more information, see Prioritizing quotas.
See also
Prioritizing quota cells for multiple choice answers