LogiView

Function 'exec_select'

     

This function combines the transferred parameters of the previously executed commands 'select', 'where', and 'order by' (optional), carries out the selection and assigns the search result data to the corresponding variables. After correct execution of the selection this function returns an integer value containing the number of records and transfers the record contents to the corresponding variables.

This command must not be called in a conditional instruction.
 

Syntax:

 

{INT_VAR}= exec_select({NUM_EXPR}) or
{INT_VAR}= exec_select({NUM_EXPR},distinct)

 

I/O parameters:

{NUM_EXPR} Number of records to be assigned to the corresponding variables (since the argument is a numerical expression, only the integer part is considered).
1 The values of exactly one record are transferred to the corresponding variables. If more then one record has been selected, all records are displayed as a menu. The user can select the record to be used.
n (>1) The values of the first n records are transferred to the corresponding variables (field elements).
0 The values of all found records are transferred to the corresponding variables (field elements).
  distinct Only unique values are selected and transferred to the corresponding variables.
-  
 

Return value:

 
{INT_VAR} Number of records that have been transferred.

In cases where the values of several data records are to be transferred (NUM_EXPR = 0 or NUM_EXPR > 1), specification of normal variables for the 'select' command must have the values of the last data record allocated after the execution of the 'exec_select' function. (All values of a selected column are sequentially allocated to the corresponding variable, overwriting the last value of each).

If a 'select' command contains any field elements then all field elements after the specified field index are overwritten by values from the specified record. You must make sure that field dimensions are defined accordingly.

 

Example:

  Declaration of Variables
 
10 select (PRO_NAME)
20 where ("T_PRO_DAT.PROJ_ID"="TEST%")
30 DOCU_INT_1=exec_select(1)
40 put(PRO_NAME)

Variable definition:
PRO_NAME  S  "T_PRO_DAT.PROJ_NAME"

Functions and commands: DB / Mask Interface