Professional > Interview scripting > Writing interview scripts > Sorting categorical response lists > Displaying responses in alphabetical order
 
Displaying responses in alphabetical order
Note Alphabetic sorting does not apply to responses that have a fixed position in the response list. For more information, see Responses with fixed positions in the response list.
In the metadata section
Sorting in ascending order from A to Z
Type the following statement in the metadata section:
Qname "Text" categorical [NumResps]
{
  Responses
} asc;
(asc can be specified as ascending.)
Sorting in descending order from Z to A
Type the following statement in the metadata section:
Qname "Text" categorical [NumResps]
{
  Responses
} desc;
(desc can be specified as descending.)
Example
In the following example, the responses will be sorted in ascending alphabetical order so “Changed your browser’s startup or home page” will come first and “Taken a seminar or class about the Web or Internet” will come last:
WhatDone "For which of the following have you used the Internet?"
categorical [1..]
{
PlaceOrder "Ordered goods/services",
DirectPurchase "Made a purchase online for more than $100",
WebPage "Created a web page",
CustomizedPage "Customized a web page for yourself",
BrowserChange "Changed your browser's startup or home page",
CookieChange "Changed your cookie preferences",
Chatrooms "Participated in an online chat or discussion",
Radio "Listened to a radio broadcast online",
Seminar "Taken a seminar or class about the Web or Internet"
} asc;
In the routing section
To sort responses in alphabetical order using a statement in the routing section, type either:
Qname.Categories.Order = OrderConstants.oAscending
or:
Qname.Categories.Order = OrderConstants.oDescending
If you specify ordering for a question in both the metadata and the routing section, the routing specification overrides the metadata specification.
For more information about defining order in the routing section, see Controlling response order from the routing section.
See also
Sorting categorical response lists