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
Put the ordering keyword immediately after the closing brace for the subsection. The responses in that section are sorted, but responses in other sections are not sorted, and the subsections themselves appear in the order in which they are defined. To sort the contents of more than one subsection, 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 always displays favorable comments before unfavorable ones, but the comments themselves are 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.
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, the randomization sequence for the responses would be different.
You can specify the same sorting in the routing section by using:
Perception1.Categories["Favorable"].Order=OrderConstants.oRandomize
Perception1.Categories["Unfavorable"].Order=OrderConstants.oRandomize
See also
Sorting response lists containing subheadings