Sorting Members

When you sort the members you include in a report, be aware that sorting commands affect members differently, depending on whether they are referenced by member selection commands or by static member definitions. Report Writer commands sort members by member name or data values.

Member selection commands such as <CHILDREN and <DESCENDANTS, select members in the order specified by the database outline. By default, a report that includes member selection commands displays members in their hierarchical database outline order. You can override this default by specifying a sort order with a sort command.

Because sort commands affect the order of the members selected by the member selection commands, they must precede any member selection commands to which they apply. If you specify a sort command, the sort order is preserved until another sort command overrides it.

Sort commands modify member selection commands, such as <CHILDREN and <DESCENDANTS. Sort commands do not perform final sorting of rows during formatting. Be careful when you place a sort command in the report script that you do not start the sort too soon, and that you override it to turn it off, if necessary, before the next selection command.

Sort commands have no effect on static member definitions.

Table 107 lists the member sort commands:

Table 107. Report Writer Commands: Member Sort

Report Command

Description

SORTALTNAMES

Sort members alphabetically by the alias name of the member, if aliases are used in the report script.

SORTASC

Sort following members in ascending order starting with the lowest generation and moving toward the highest generation.

SORTDESC

Sort following members in descending order starting with the highest generation and moving toward the lowest generation.

SORTGEN

Sort following members according to the generation of the member in the database outline.

SORTLEVEL

Sort following members according to the level of the member in the database outline.

SORTMBRNAMES

Sort members alphabetically by member name.

SORTNONE

Disable all previous sorting commands so that members added to the report follow the normal hierarchical order based on the database outline.