Documentor Functions : Overview of the Extraction Functions : Using Database Extraction Functions

Using Database Extraction Functions

Database extraction function calls can appear anywhere in your template where expressions of the same type are valid.

Consider the following call:

state_id := stm_r_st (’S1’, status);

This call retrieves the state whose name is S1 from the database and assigns it to the variable state_id. (In actuality, the call retrieves the state’s ID. This ID is a value that Rational Statemate uses to identify each element in the database.)

Function calls are frequently used in sequence. For example, because you have already retrieved the ID for state S1, you can now call the following function:

sub_st := stm_r_st_physical_sub_of_st
({state_id}, status);
 

This function call builds a list of substates contained in state S1 and assigns the list to the variable sub_st.

At this point, you can print out a list of all substates of state S1. The list is to include the name of the individual state as well as the description appearing in the state’s form. To do this, include the following lines in your template:

FOR s in sub_st LOOP
WRITE (’\n Name:’, stm_r_st_name (s, status));
WRITE (’\n Desc:’, stm_r_st_description (s, status));
END LOOP;