Utility Functions : List of Utility Functions : stm_list_sort_by_attr_value

stm_list_sort_by_attr_value
Sorts the specified list of Rational 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.
Function Type
stm_list
Syntax
stm_list_sort_by_attr_value (list, attr_name, &status)
Arguments
Input/Output
The function returns the status code. stm_elements_without_attributes if you apply this function to a list of elements that do not have the specified attribute.
 
Status Codes
Example
To sort activities by the name of an attribute called code, use the following function calls:

 

stm_list act_list, ord_act_list;
stm_id el;
int status;
.
.
ord_act_list = stm_list_sort_by_attr_value (
act_list,"code", &status);
printf("\n Ordered list of activities:");
.
.

This example prints a particular list of activities from the database. Assume you extracted the activities of interest using single-element and query functions and built a list of such activities. This list is assigned to the variable act_list.