Script trigger

Script Trigger
When you create a new script of the "Trigger" type, three predefined methods are available to you.
Methods in the trigger object
Method | Description |
---|---|
Initialize | The method is called once when the OPC Router is started. Here you define at least the "Query interval", that means the interval at which the system checks wheter the trigger condition applies. |
CheckTrigger | Method in which the trigger condition is stored. It is called cyclically in the "Query Interval" (see above). The method returns true or false . If true , the data transfer is triggered. |
ResetTrigger | The method is called after the data transfer has been completed. The parameter (bool transferError) is automatically passed (true = Transfer error). Error handling can therefore also be programmed in this method. |
You create the parameters via the "Settings - Edit parameters" menu. The script trigger only recognises input parameters, so you cannot specify a direction here.
The parameter value is defined in the connection configuration. It cannot be determined dynamically at runtime. If you require actual values at runtime, you would have to programme corresponding OPC accesses or database queries in the trigger. The input parameters make it possible to use the same script in different ocnnections that require fundamentally different properties (table names, access paths, etc.).\
When you create a new script, the script editor opens automatically.