Utility Functions : Examples of Utility Functions : Utility Functions Example 1

Utility Functions Example 1

The following example shows how to find the number of subactivities that exist for activity A1.

VARIABLE
ACTIVITY act_id, cntrl_act;
LIST OF ACTIVITY act_list, cntrl_act_list;
INTEGER status, list_length;
.
.
act_id := stm_r_ac (’A1’, status);
act_list := stm_r_ac_physical_sub_of_ac ({act_id},
status);
list_length := stm_list_length (act_list, status);
.
.

The example uses a single-element function to determine the ID of A1, then uses a query function to retrieve the list of A1’s subactivities. Finally, it assigns the number of A1’s subactivities to list_length.