PUBLIC local variables
When you run a script using the action EVENT, you can define parameters to be sent to another script you want to be started. Sending the parameters is implemented as filling defined local variables of a started script with values from local variables of the script, that calls the action EVENT.
Example - Script that calls another script with the nameE.SubScript
INT _i_i := 1
EVENT E.SubScript(_par1 = _i)
END
Script
E.SubScript
PUBLIC INT _par1PUBLIC INT _par2
_par1 := 2
END
In the first script, the local variable _i is declared initialized to the value of 1 before calling
the script E.SubScript
. Starting the embedded script E.SubScript
is performed by copying the value of the local variable _i of the first event into the local (PUBLIC)
variable _par1
in the called script. During this operation, existence
of all the local variables of the called script is verified. These local variables must be declared as PUBLIC.
In case of a reference to a system object (ALIAS), the value is not, but the reference. The action
EVENT is synchronous, so it waits for the termination of the embedded (called)
script. After its termination, values (and references) are copied back into the local variables of the calling
script. In case of local variables of ALIAS type, references are copied. If some of the PUBLIC local variables
are not initialized, when calling the script, their values, unlike others, are invalid.
Note
- When you edit a script in the process D2000 CNF, the existence of PUBLIC local variables in called script is not checked.
Related pages:
Pridať komentár