Askia Quota Methods and Keywords
With 5.6, we have implemented four new Quota methods which will dramatically simplify the set-up of your surveys when you want some balanced or least filled quotas. So it is goodbye to QuotaToDo, MaxQuotaToDo and other IsQuotaFullFor . . . and hello to OpenBalancedQuota!
These four methods (OpenQuota(), OpenBalancedQuota(), QuotaList(), BalancedQuotaList()) are used to execute queries in the AskiaField engine in order to get information about quotas. They have a global scope, so are available everywhere from the AskiaScript.
These methods are attached to a question's object:
Gender.OpenQuota() or Brands.OpenBalancedQuota()
The selection is done using the minimum to do except if that’s higher than the maximum allowed. So we combine looking for the worst-case scenario. Looking for the maximum to do using the minimum target, keeping in mind the minimum allowed using the maximum target.
Category
A quota category is a set of questions and responses, and NOT a path in the quota tree. So it doesn’t matter what the structure of the quota tree is: the category only describes a set of questions and responses. The benefit of this is that the user doesn’t have to know what the quota tree looks like. They will always get a usable response. This also means that if the quota tree changes, the routing will keep working – always.
Category rules:
- List question/response (you can define one or several responses per question).
- Accept index or entry code (for entry code use speech mark “” or string array {""}).
- Separate question and response by a colon (":").
- Separate each question/response by a comma (",").
- TargetQuestion.Method (shortcut2:3,shortcut1:"5") ->index 3 for the question "shortcut2" and entry code 5 for the question shortcut1.
- The order of the question/response is not important: E.g. TargetQuestion.Method(shortcut2:3,shortcut1:"5") is the same as TargetQuestion.Method(shortcut1:"5",shortcut2:3).
- Quota questions not in category use current answer.
- To refer to the DK/NA/Invalid row in the script, use the DK keyword.
- Category questions not in quota are ignored.
- Choices from categories with equal status are randomized.
Methods
OpenQuota( [Category])
A list of index of the responses of the TargetQuestion is still available ( to do > 0) and sorted from the max to do to the min to do using the count for the sort and returned as an Array.
Various examples with a quota tree: Gender x Age x Region
Example 1:
Search the available responses for the question 'Age' in the first 'Region' level and for 'Men':
Age.OpenQuota(Region:1, Gender:1)
Example 2:
Search the available responses for the question ‘Age’ in the first, third, fourth or fifth 'Region' level and for 'Men':
Age.OpenQuota(Region:{1;3 to 5}, Gender:1)
Example 3:
Search the available responses for the question 'Age', in the 'Region' level with the entry code 3 and the 'Gender' with the entry code 7:
Age.OpenQuota(Region:"3", Gender:"7")
Example 4:
Search the available responses for the question 'Age', in the 'Region' level with the entry code 3 or 5 and the 'Gender' with the entry code 7:
Age.OpenQuota(Region:{"3";"5"}, Gender:"7")
OpenBalancedQuota( [Category])
List of indexes of the responses of the TargetQuestion still available ( to do > 0) and sorted from the max to the min using the following formula for the sort: (Target% - Observed%).
Returned as an Array.
Various examples with a quota tree: Gender x Age x Region
Example 1:
Search the available balanced responses for the question 'Age' in the third 'Region' level and for 'Women':
Age.OpenBalancedQuota(Region:3, Gender:2)
Example 2:
Search the available balanced responses for the question ‘Age’ in the first, fourth or fifth 'Region' level and for 'Women':
Age.OpenBalancedQuota(Region:{1;4;5}, Gender:2)
Example 3:
Search the available balanced responses for the question 'Age', in the 'Region' level with the entry code 3 and the 'Gender' with the entry code 7:
Age.OpenBalancedQuota(Region "3", Gender:"7")
Example 4:
Search the available balanced responses for the question 'Age', in the 'Region' level with the entry code 3 or 5 and the 'Gender' with the entry code 7:
Age.OpenBalancedQuota(Region:{"3";"5"}, Gender:"7")
QuotaList( [Category])
Complete list of indexes of the responses of the TargetQuestion sorted from the max to do to the min to do using the count for the sort.
Returns an Array.
Various examples with a quota tree: Gender x Age x Region
Example 1:
Search the list of responses for the question 'Age', in the first 'Region' level and for the 'Man':
Age.QuotaList(Region:1, Gender:1)
Example 2:
Search the list of responses for the question 'Age', in the first, third, fourth or fifth 'Region' level and for the 'Man':
Age.QuotaList(Region:{1;3 to 5}, Gender:1)
Example 3:
Search the list of responses for the question 'Age', in the 'Region' level with the entry code 3 and the 'Gender' with the entry code 7:
Age.QuotaList(Region:"3", Gender:"7")
Example 4:
Search the list of responses for the question 'Age', in the 'Region' level with the entry code 3 or 5 and the 'Gender' with the entry code 7:
Age.QuotaList(Region:{"3";"5"}, Gender:"7")
BalancedQuotaList( [Category])
Complete list of indexes of the responses of the TargetQuestion sorted from the max to the min using the following formula for the sort: (Target% - Observed%).
Returns an Array.
Various examples with a quota tree: Gender x Age x Region
Example 1:
Search the list of responses for the question 'Age', in the first 'Region' level and for 'Men':
Age.BalancedQuotaList(Region:1, Gender:1)
Example 2:
Search the list of responses for the question 'Age', in the first, third, fourth or fifth 'Region' level and for 'Men':
Age.BalancedQuotaList(Region:{1;3 to 5}, Gender:1)
Example 3:
Search the list of responses for the question 'Age', in the 'Region' level with the entry code 3 and the 'Gender' with the entry code 7:
Age.BalancedQuotaList(Region:"3", Gender:"7")
Example 4:
Search the list of responses for the question 'Age', in the 'Region' level with the entry code 3 or 5 and the 'Gender' with the entry code 7:
Age.BalancedQuotaList(Region:{"3";"5"}, Gender:"7")
Note
The quota methods can be applied to closed questions but not numerical or calculated questions.
For grouped responses, the methods will always return the full list of responses:
Age with 3 responses:
- Less than 25
- 25 to 34
- 35 and more.
One group created for 25 and more.
- Less than 25
- 25 and more
- 25 to 34
- 35 and more.
If the response Less than 25 has still 100 interviews to do and the group 25 and more has still 150 to do, then you can use:
Age.OpenQuota() will return {2;3;1}