Step 4 - Starting the trigger to insert data
After completing steps 1 through steps 3, the example trigger can be started to have the data inserted into the database table.
Starting the project
A project must be in a Started state in order for the triggers in the project to be able to execute.
- From the Workbench left pane, expand the node that
contains your project.
- Expand the Projects icon, and then
locate the project you want to start.
- Select the project, and then display its pop-up
menu.
- Select Start.
- The project icon changes to a started state and a
green check mark appears on the project tab.
In the Projects tab, the State column for the project changes to Started and a green check mark appears.
The state of the project is persisted to the node's internal configuration tables. When a node is restarted, the state of the project is set to its state when the node was shutdowm.
Starting the trigger
- To change the state of a trigger to
Started, double-click the project that
you just started (or select the Open
button).
The project tab that contains the trigger appears. - Locate the trigger you want to start, display its
pop-up menu, and then select
Start.
The State column for the trigger changes to Starting and then to Started and a green check mark appears.
The state of the trigger is persisted to the node's internal configuration tables. When a node is restarted, the state of the trigger is set to its state when the node was shutdowm.
When the trigger is executing, the value of the
Successes column is incremented.
If there is a problem, the value of the Failures column is incremented.
Summary
For this example trigger, the data from the device
variables is formatted into an Insert
operation and inserted into the database table every 5
seconds.
The Successes column value should be incrementing.
A DB2 database utility can be used to view the data in the database table.
After executing the trigger for a while and viewing the data, you can stop the trigger.