Utility Functions : List of Utility Functions : stm_list_sort_by_name

stm_list_sort_by_name

Function type: LIST OF ELEMENT

Description
Sorts the specified list of Statemate elements alphabetically by name.
Note the following:

The function returns the status code stm_elements_without_name when you attempt to apply this function to a list that contains unnamed elements.

The function receives and returns a list of element IDs, not a list of element names.

Syntax
stm_list_sort_by_name (list, status)
Arguments
 
The list of Statemate elements to be sorted. This input lists consists of element IDs.

 

Status Codes
Example
Suppose you want to write a particular list of activities from the database to your document. You extract the activities of interest using single-element and query functions and build a list of such activities. This list is assigned to the variable act_list. To alphabetically sort the activities by their names, your template should contain the following statements:

VARIABLE
LIST OF ACTIVITY act_list, ord_act_list;
ACTIVITY activ;
INTEGER status;
.
.
ord_act_list := stm_list_sort_by_name (act_list, status);
WRITE (’\n Ordered list of activities:’);
FOR activ IN ord_act_list LOOP
WRITE (’\n’, stm_r_ac_name (activ, status));
END LOOP;