Trigger scripts
When you create a new script of the "Trigger" type, three predefined methods are available:
Methods in the trigger object
| Method | Description |
|---|---|
| Initialize | The method is called once when the OPC router is started. Here you specify at least the "Query Interval," i.e., the interval at which the trigger condition is checked. |
| 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 failed). Error handling can therefore also be programmed in this method. |
You can create the parameters via the "Settings – Manage Parameters" menu. The script trigger only recognizes 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 need current values at runtime, you would have to program corresponding OPC accesses or database queries in the trigger. The input parameters allow the same script to be used in different connections that require fundamentally different properties (table names, access paths, etc.).
When you create a new script, the script editor opens automatically.