21. 4GL Statement Glossary : Callframe : Passing Values from the Calling Frame
 
Share this page                  
Passing Values from the Calling Frame
You can pass values from the form of the calling frame to the form of the called frame by means of a series of assignment statements in the callframe parameter list. You can pass values to a specified simple field, to all simple fields, or from a table-field row to the corresponding simple fields in a form, or to arrays. Each of these methods is discussed below.
To a Simple Field from the Calling Frame
You can pass a single value to a simple field or local variable in the called frame using the syntax shown below. This is like a simple assignment. You can optionally prefix the form name of the called frame to the fieldname that is to receive the value:
[calledformname.]fieldname := expression
You can also pass a value to a called frame with the byref statement. This allows the field in the calling frame that contains the passed value to be changed by the processing in the called frame. See Passing Parameters by Value or by Reference in Using the Callframe Statement for further discussion of passing values by reference.
Use this syntax:
[calledformname.]fieldname := byref (formobject)
Formobject is a field name, a table-field column name, or a local variable in the calling frame.
To All Simple Fields from the Calling Frame
Use the option all to assign the values in all the simple fields in the calling frame to simple fields in the called frame. To do so, use this syntax for the parameterlist:
calledformname := callingformname.all
In this case, each simple field in the calling frame must correspond in name and data type to a field in the called frame. The called frame can, however, contain fields not corresponding to fields in the calling frame. The mapping ignores any local variables.
To Simple Fields from a Table-Field Row
Use the option all to assign the values in all the columns of a table-field row in the calling frame to simple fields in the called frame, using this syntax:
calledformname := callingtablefieldname
   
 [[integerexpr]].all
Each table-field column in the calling frame's form must correspond in name and data type to a field in the form of the called frame. However, the called frame can contain additional fields that do not correspond to fields in the calling frame.
The row from which the values are passed is the row on which the cursor is currently resting, unless you specify another row by its number in an integer expression (enclosed in square brackets or vertical bars). In this case, the values are taken from the row with that number. The mapping ignores hidden columns.