Least filled quota routing on multi-coded questions
Least filled quota routing for a multi-coded question
- Download the example .qex file (5.3.X)
- Download the example task package (5.3.X)
- Download the example .qex file (5.4.X)
- Download the example task package (5.4.X)
Many of you will be familiar with least filled routing i.e. checking quotas and using their values to determine questions to be asked of a respondent.
Below is a basic example of how we would do this for a multi-coded question:
In 5.4.X versions (quota on multiple questions allowed):
In 5.3.X versions:
The survey can be tested here. As you can see, with 5.4.X. Versions of Design and CCA, the structure and routing logic required is greatly simplified compared to 5.3.X, particularly the fact that we can deal directly with multiple questions without having to split them up into individual variables per response.
Task packages can be imported as shown below. This will allow you to import the task and quotas in one go and test the survey as live.
Least filled quota routing for a multi-coded question inside a loop
- Download the example .qex file (5.3.X)
- Download the example task package (5.3.X)
- Download the example .qex file (5.4.X)
- Download the example task package (5.4.X)
In 5.4.X versions (quota on multiple questions allowed):
The routing below returns into variable top3 the items, per brand, that have the three highest quota to do counts . . .
In 5.3.X versions:
The routing below returns into variable top3 the items, per brand, that have the three highest quota to do counts . . .
* line 11 in the routing above is the only difference required between 5.3.X and 5.4.X because we deal with a multiple rather than several single coded questions with one response.
The first eight lines merely define variables that we will use further on in our code.
The section of code below populates arr with the quota to do values of all 5 items in s1.
For i = 1 to intNbResponse
arr.insert(QuotaToDo("item" + (intStep + i) + ":" + 1))
Next i
The following code reorders arr from the most quota to do to the least quota to do and sets it into arrOrdered . . .
For j = 1 to intNbResponse
arrOrdered = arrOrdered + arr.IndexOfMax(j)
Next j
Here, the code selects the 3 highest quota to do values from those items selected in s1 and sets them into arrMax3 . . .
For k = 1 to 3 arrMax3 = arrMax3 + (arrOrdered intersection s1)[k]
Next k
‘For k = 1 to 3’ can easily be changed to select the top 1, 2, 4, 5, 100.. etc
Finally, here we return the result we want to set into our top3 variable in the survey:
Return arrMax3
itemloop is then linked on all selected responses to top3.
Here the respondent is in a loop of up to five items selected at s1 and also in a loop of three brands.
You can use their responses at this stage to update the quotas for items by brand before they exit the interview. See routings setting value into variables item1 to item15. If they have code 1 at least filled item they will increment the quota by 1.
You can test the example survey here.