Function type:
LIST OF ELEMENT
Sorts the specified list of Statemate elements by the value of the given attribute.Note that the function receives and returns a list of element IDs, not a list of element names.
The function returns the status codestm_elements_without_attributes
if you apply this function to a list of elements that do not have the specified attribute.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 variableact_list
. To sort the activities by the value of an attribute called “code”, your template should contain the following function calls:VARIABLE
LIST OF ACTIVITY act_list, ord_act_list;
ACTIVITY activ;
INTEGER status;
.
.
.
ord_act_list := stm_list_sort_by_attr_value (act_list,
’code’, status);
WRITE (’\n Ordered list of activities:’);
FOR activ IN ord_act_list LOOP
WRITE (’\n’, stm_r_ac_name (activ, status));
END LOOP;