Sample Program : Program Description : Retrieving the Information

Retrieving the Information
void activities_info (ac_list)
stm_list ac_list;

This function retrieves both the textual and graphical information contained in the database.

{
stm_ac_text_ptr ac_textual;
stm_ac_graphic_ptr ac_graphical;
stm_id el;

These statements declare variables to point to textual and graphical records, and to include the ID for an activity. The structure of these records is defined in dataport.h.

for (el = (stm_id) stm_list_first_element (ac_list,
&status);
status == stm_success;
el = (stm_id) stm_list_next_element (ac_list,
&status)
)
stm_list_next_element (ac_list, &status))

These statements loop through each element in the activity list. The status of stm_list_next_element is not equal to stm_success when there are no more elements in the list.

{
ac_textual = stm_r_ac_text (el, &status);
if (status == stm_success)
activity_text_output (ac_textual);

 

This statement retrieves the textual information for an activity. If successful, it writes the information into the report.

ac_graphical = stm_r_ac_graphic (el, &status);
if (status == stm_success)
activity_graphic_output (ac_graphical,
ac_textual->ac_name);
}
}

This statement retrieves the graphical information for an activity. If successful, it calls the graphic output routine, passing the name for the activity.