Single-Element Functions : Calling Single-Element Functions : Examples of Single-Element Function Calls : Single-Element Function Example 1

Single-Element Function Example 1

Suppose you want to find the synonym and the short description for a state S1, as they appear in the state’s form. Assume that the path name SSS.S1 uniquely identifies the state. Include the following code in your Documentor template:

VARIABLE
STATE state_id;
STRING state_desc, state_syn;
INTEGER status;
.
.
state_id := stm_r_st (’SSS.S1’, status);
state_syn := stm_r_st_synonym (state_id, status);
state_desc:= stm_r_st_description (state_id, status);
.
.

This example uses two consecutive function calls to extract first the synonym, then the short description of the same element. The assigned variable and the function return value must have compatible data types. Therefore, state_id is declared as STATE. (state_id could also be declared as ELEMENT.)