Skip to main content

Trigger Scripts

When you create a new "Trigger" script, you have three predefined methods available:

Methods in the Trigger Object

PropertyDescription
MethodDescription
:------:-----------
InitializeThis method is called once when the OPC router is started. Here, you must specify at least the “Query Interval”—that is, the interval at which the system checks whether the trigger condition is met.
CheckTriggerMethod in which the trigger condition is defined. It is called cyclically at the “Query Interval” (see above). The method returns true or false. If true, the data transfer is triggered.
ResetTriggerThis method is called after the data transfer is complete. The parameter (bool transferError) is automatically passed (true = transfer failed). Error handling can therefore also be programmed within this method.

You can create the parameters via the “Settings – Manage Parameters” menu. The script trigger only recognizes input parameters; therefore, you cannot specify a direction here.

The parameter value is defined in the flow configuration. It cannot be determined dynamically at runtime. If you need current values at runtime, you would need to program corresponding OPC accesses or database queries in the trigger. Input parameters allow you to use the same script in different flows that require fundamentally different properties (table names, access paths, etc.).

When you create a new script, the script editor opens automatically.