Utility Functions : List of Utility Functions : stm_list_sort_by_synonym

stm_list_sort_by_synonym

Function type: LIST OF ELEMENT

Description
Sorts the specified list of Statemate elements alphabetically by their synonyms.
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_synonym (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 synonyms, your template should contain the following statements:

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