Model Templates : Activity Interface Report : Activity Interface Report Segment Section : Writing the Input Elements

Writing the Input Elements

The next part of the template segment gives instructions for writing each element’s type (event, condition, or data-item), followed by its name. To do this, use a FOR/LOOP construct to both extract an element elm out of the alphabetized in_list and perform several statements iteratively.

The first statement in the loop extracts the type of the element represented by the variable elm. The template then uses a SELECT/WHEN construct to write the element type and name. The triggers of the WHEN statements are constructed so when the variable elm_type is equal to a particular element type, the WRITE statement to the right of the arrow is executed.

“Element type” is referred to as an enumerated type; each of the possible values is represented by a unique number. These numbers correspond to predefined constants (stm_event, stm_condition, and stm_data_item). Note that the template does not use the value of the variable elm_type to write the element type; doing so would cause the integer value to be written. Instead, the template writes the string that corresponds to the integer value.

You must use a database extraction function in the WRITE statements to produce the elements’ names because the variable elm that represents the individual element (as well as the list of elements represented by the variable in_list) consists of element IDs, rather than names. To produce the element’s names, use the IDs as parameters in a database extraction function that returns element names.

After the WHEN construct is executed and the element’s type and name is written, the program loops back to the beginning of the FOR/LOOP and the instructions are carried out for another element. This continues until all input elements are written.

The last part of the template constructs lists of output elements and writes their types and names. This part is identical for that of input elements, except that a different function is used to build the output a-flow-line elements.

The final output is shown in the next section.