execute()

Examples


The execute() function allows you to compile and execute sanScript code at runtime. The code passed to the execute() function is called pass-through sanScript.

Syntax

execute ({product_ID,} source, compile_error_message {, parameters})

Parameters

product_ID An optional integer that specifies the product ID of the dictionary in which you want to execute pass-through sanScript. This is useful if you want to access functionality in another application dictionary within the multidictionary environment.

source – A string or text expression containing the sanScript code to compile and execute.

compile_error_message – A returned string containing any compiler error that occurred when the sanScript code was compiled.

parameters – Optional parameters to be passed to the sanScript code.

Return value

An integer indicating the number of compiling errors that occurred.

Comments

If you need to include a literal string in the pass-through sanScript code, you must enclose the string in two sets of quotation marks so the compiler will interpret the string properly.

When referencing resources in pass-through sanScript code, you must qualify the names based on which script will run the execute() function. For instance, if the execute() function will be run from a field change script, you must qualify all resource names in the pass-through sanScript code the same way you would qualify them in the field change script.

You can pass parameters into and out of pass-through sanScript code similar to the way you pass parameters into and out of procedures and functions. Simply declare the in, out or inout parameters at the beginning of the pass-through sanScript. Then pass the parameters to the script using the optional parameters for the execute() function.

By default, pass-through sanScript has access to the same table buffers as the script that runs the execute() function. For instance, if the execute() function is run from a field change script, the pass-through sanScript code will have the access to the same table buffers as that field change script. If the execute() function is run in a procedure or function script, the pass-through sanScript code will have access to its own private table buffers. If you want pass-through sanScript to access other table buffers, you must pass them in as parameters.


Documentation Feedback