Scroll

5.4: New Quotas Keywords

5.4: New Quotas Keywords

Follow

With 5.4, we have implemented 4 new Quota methods which will dramatically simplify the set-up of your surveys when you want some balanced or least filled quota. So long QuotaToDo, MaxQuotaToDo and other IsQuotaFullFor … Hail to AvailableBalancedQuota !

These 4 methods (AvailableQuota(), AvailableBalancedQuota(), QuotaList(), BalancedQuotaList())  are used to execute queries in AskiaField engine in order to get information about quotas. They are on the global scope, so it’s available everywhere in the AskiaScript.

These methods are attached to question's object :

Gender.AvailableQuota() or Brands.AvailableBalancedQuota()

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 + 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 + responses. The benefit of this is that the user doesn’t have to know what the quota tree looks like… He’ll 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 speach 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 : 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
  • The ex aequo are randomized

 

METHODS


AvailableQuota( [Category])


List of index of the responses of the TargetQuestion 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 the 'Man' :

Age.AvailableQuota(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 the 'Man':

Age.AvailableQuota(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.AvailableQuota(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.AvailableQuota(Region:{"3";"5"}, Gender:"7")

 

 

AvailableBalancedQuota( [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%).
Return 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 the 'Woman' :

Age.AvailableBalancedQuota(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 the 'Woman':

Age.AvailableBalancedQuota(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.AvailableBalancedQuota(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.AvailableBalancedQuota(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 the 'Man':

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 the 'Man':

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 if you use

Age.QuotaAvailable() will return {2;3;1}

Have more questions? Submit a request

Comments