Desktop User Guides > Professional > Interview scripting > Writing interview scripts > Sorting categorical response lists > Displaying responses in alphabetical order
 
Displaying responses in alphabetical order
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:
<question_name> "<text>" categorical [<number_of_responses>]
{
  Responses
} asc;
asc can be specified as ascending.
Sorting in descending order from Z to A
Type the following statement in the metadata section:
<question_name> "<text>" categorical [<number_of_responses>]
{
  Responses
} desc;
desc can be specified as descending.
Example
The following example sorts the responses in alphabetical order, so “Changed your browser’s startup or home page” is first and “Taken a seminar or class about the Web or Internet” is 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:
<question_name>.Categories.Order = OrderConstants.oAscending
or:
<question_name>.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