Desktop User Guides > Professional > Interview scripting > Writing interview scripts > Sorting categorical response lists > Sorting response lists containing subheadings > Sorting responses in a subsection
 
Sorting responses in a subsection
Place the appropriate ordering keyword immediately after the closing brace for the subsection. The responses within that section will be sorted, but responses in other sections will not be sorted, and the subsections themselves will appear in the order in which they are defined. If you want to sort the contents of more than one subsection, you must give each section its own ordering keyword. For example, if the question is defined as:
Perception1 "What things would you mention about the Internet
    if you were describing it to a friend?" categorical [1..]
{
Favorable "Good things"
{
EasytoUse "Easy to use",
LotsOfInfo "Access to a lot of information",
PeopleLikeMe "Can chat to people with same interests",
BuyOnline "Good way to buy goods/services"
} ran,
Unfavorable "Bad things"
{
NotReliable "Not a secure way to make purchases",
BadExperience "I had a bad experience in the past",
NotPrivate "Need to guard personal information",
Difficult "It's difficult to find appropriate web sites"
} ran
};
the interviewing program will always display favorable comments before unfavorable ones, but the comments themselves will be shown in a random order in each subsection:
Interview page showing sorted responses within subsections but unsorted sections
This graphic is described in the surrounding text.
Note that the responses in the two subsections are presented in the same random order. This is because there are the same number of responses in each subsection. If one subsection had more responses than the other, then the randomization sequence for the responses would be different.
You can specify the same sorting in the routing section using:
Perception1.Categories["Favorable"].Order=OrderConstants.oRandomize
Perception1.Categories["Unfavorable"].Order=OrderConstants.oRandomize
See also
Sorting response lists containing subheadings