Controlling response order from the routing section
Specifying response order using statements in the routing section can sometimes give you more flexibility than specifying the response order as part of the question definition in the metadata section. In particular, you can change the order based on answers to previous questions or you can ask respondents to choose an order (for example, most expensive first).
The general syntax for defining ordering in the routing section is:
<question_name>.Categories.Order = OrderConstants.<order>
where <order> is one of oAscending, oDescending, oRotate, oRandomize, oReverse, or oCustom.
For example, if the metadata section contains the following questions:
CurrentISP "Who is your current Internet Service Provider (ISP)?"
categorical [1..1]
{
use ISPList
};
SortISP "Now some questions about your ISP. How would you like
to sort your choices?" categorical [1..1]
{
Ascen "Alphabetically A-Z",
Descen "Alphabetically Z to A"
};
you would place the following statements in the routing section to present the response list in the order that the respondent requests:
SortISP.Ask()
If SortISP= {Ascen} Then
CurrentISP.Categories.Order = OrderConstants.oAscending
CurrentISP.Ask()
ElseIf SortISP = {Descen}
Then CurrentISP.Categories.Order = OrderConstants.oDescending
CurrentISP.Ask()
End If
Custom ordering
Use oCustom order when you want to use a customized order that cannot be achieved using the standard ordering keywords. A typical example is ordering by size or price. In cases such as these, you need to list the responses in the routing section in the order they are to be displayed and then use the oCustom setting to make the interviewing program pick up this order. Here is an example. In the metadata section you have:
CompareISP "The following list shows other ISPs in {Order} price
order." categorical [1..]
{
use ISPList
};
Ordering "Why not compare the cost of your ISP with others?
How would you like to sort the list?" categorical [1..1]
{
PriceAscen "By price, ascending",
PriceDescen "By price, descending"
};
In the routing section you have:
Ordering.Ask()
If Ordering = {PriceAscen} Then
CompareISP.Categories.Filter = _
{OnTheWeb,GetOnline,InternetAtHome,YourISP,OneStop,
ThePhoneCompany}
CompareISP.Categories.Order = OrderConstants.oCustom
CompareISP.Label.Inserts["Order"].Text = "ascending"
CompareISP.Show()
ElseIf Ordering = {PriceDescen} Then
CompareISP.Categories.Filter = _
{ThePhoneCompany,OneStop,YourISP,InternetAtHome,GetOnline,
OnTheWeb}
CompareISP.Categories.Order = OrderConstants.oCustom
CompareISP.Label.Inserts["Order"].Text = "descending"
CompareISP.Ask()
When repeated questions are displayed as a grid, you must use the same order for the items in the loop control list for all repetitions. If the questions are asked separately you might use a different order for some repetitions.
Rotation and randomization with grids
If the order of responses in a row or column of a grid differs from the order of those responses in the header row or column, the interviewing program does not display the grid. Instead, it displays an error message and writes that message to the IVW* log file. This prevents data corruption that would happen if the script was allowed to run as written.
To avoid this error, specify rotation or randomization for loops in the metadata section of the script, because this ensures that all iterations of the loop use the same rotation or randomization pattern. If you have to specify rotation or randomization in the routing section, set the program’s state before requesting the reordering. For example, always set the randomization seed before requesting randomization, as shown here:
For Each Question In MyLoop
SetRandomSeed(IOM.Info.RandomSeed)
Question.Order = OrderConstants.oRandomize
Next
See also