callerslocalvariablevalue(
callerslocalvariablevalue(
VARIABLE
)

The callerslocalvariablevalue( function allows a subroutine to access a local variable in the procedure that called it.

Parameters

This function has one parameter:

variable – name of the variable to be accessed. This name must be quoted.

Description

This function allows a subroutine to access a local variable in the procedure that called it. Normally a procedure can only access its own local variables, all others are out of bounds. For example, consider this code which sets up two local varaibles and then calls a subroutine.

    let color = "Blue"
    let shape = "Star"
    call dispatch

Normally the dispatch procedure would have no access to the local variables set up in the procedure above, but with the callerslocalvariablevalue( function it can, like this:

    message callerslocalvariablevalue("color")+" "+callerslocalvariablevalue("shape)

When the original code code is run, it will display the message Blue Star.

Warning: The callerslocalvariablevalue( function is a very unstructured way to handle data (as are its counterparts, setcallerslocal and info(“callerslocalvariables”)). Usually a much better way to pass a value to a subroutine is to use a parameter (see the parameter( function). However, if you write your own custom statements, this feature can be very useful to allow a custom statement to access a local variable in the procedure it is used in.

Error Messages

callerslocalvariablevalue( function can only be called from inside a subroutine – This function can only be used in a subroutine, if not in a subroutine, there are no caller’s local variables to access!

See Also

- call -- allows a procedure to call a separate procedure within the current database as a subroutine.
- execute -- allows a procedure to call a sequence of statements within the current procedure as a "mini-subroutine".
- executelocal -- is the same as the execute statement, but it shares local variables with the procedure that called it.
- info("callerslocalvariables") -- returns a list of local variables defined in the procedure that called the current procedure.
- return -- ends a subroutine.
- setcallerslocal -- allows a subroutine to modify a local variable in the procedure that called it.
- shortcall -- allows a procedure to call a sequence of statements within the current procedure as a "mini-subroutine".
- usecallerslocalvariables -- temporarily swaps out a subroutine's current local variables with the local variables of the procedure that called this subroutine. The statement can be used only in a subroutine, not in a calling procedure.
- usemylocalvariables -- reverses the action of the UseCallersLocalVariables statement, switching back to the current procedure's normal local variables.

History

Version | Status | Notes
10.2 | New | New in this version.