Trigger Script
When you create a new script of type “Trigger”, there are three predefined methods 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”, the interval in which it is checked whether the trigger condition is correct. |
CheckTrigger | Method in which the trigger condition is stored. It is called cyclically in the “query interval” (see above). The method returns back true or false . At true the data transfer is triggered. |
ResetTrigger | The method is called after successful data transfer. The parameter is automatically transferred (bool transferError) (true = transfer error). In this method, an error handling can also be programmed. |
Use the “Settings - Edit parameters” menu to set the parameters. The script trigger only knows input parameters, so you can not specify a direction here.
The parameter value is defined in the connection configuration. It is not dynamic at runtime. If you need actual values at runtime, you would need to program corresponding OPC accesses or database queries in the trigger. The input parameters make it possible to use the same script in different connections, which basically require different properties (table names, access paths, etc.).
When you create a new script, the editor automatically opens for editing.