The call( function allows a procedure to be called as a subroutine within a formula and return a result.
This function has three parameters:
database – is the database containing the procedure you want to run, or
"" to use a procedure within the current database.
procedure – is the name of the procedure you want to run. The name of the procedure must be quoted.
parameters – is a list of parameters to be passed to the subroutine. This list is optional, you don’t have to pass any parameters if you don’t need to. See parameter( and setparameter for more information on accessing parameters within a subroutine.
The call( function allows a procedure to be called as a subroutine within a formula and return a result. The procedure must contain a functionvalue statement that tells Panorama what value to return from the function. (The procedure may contain multiple functionvalue statements, in which case the function will return the value of the last functionvalue statement executed.)
The call( function (and execute( function) allow you to perform procedure statements anywhere a formula is allowed, including in form objects, formulafill, etc. There are some significant restrictions that the procedure called by this function must follow:
The procedure cannot have any database-related side effects. In other words, it cannot modify any database fields (variables are ok).
The procedure cannot move to a different record in the current database (it cannot move up or down, or search).
The procedure cannot switch to a different window (including a secret window) or to a different database.
The procedure cannot change window mode (for example it cannot change a form window from data mode to graphics mode).
The procedure cannot display an alert or dialog.
You should also be careful to make the procedure run as fast as possible. Since the procedure may be triggered by a formula in a form that is displayed or printed, or in a formulafill statement, it should be kept as short and fast as possible.
The call( function allows you to supply one or more parameters to be passed to the subroutine (parameters must be separated by a comma). When using the call( function, the parameters are listed after the database and procedure name, like this:
call("database","procedure",parameter1,parameter2,parameter3, ... parameterN)
If there is a syntax error in the subroutine (misspelled command, unexpected formula operator, etc.) the function will return an error message describing the problem instead of the calculated value (since there is a syntax error, it cannot even try to run the program).
If there is a run-time error in the subroutine (for example a missing variable, incorrect data type, etc.) the function will also return an error message describing the problem. Or you can also use the if error, try, catch or onerror statements (see Error Handling) to trap the error yourself and take appropriate action without returning an error. You can even combine the functionvalue statement with the error( function to return your own custom error message.
procedure called by call( function does not return a value (you must add the functionvalue statement) – The procedure that is called must include a functionvalue statement. If there is a functionvalue statement and you still see this error, the functionvalue is not being executed – check the logic of the procedure.
|10.0||No Change||Carried over from Panorama 6.0.|