Update or Insert Group
You can update a row or insert a new row into the database when a key pair combination does not exist. This eliminates the need to have a database that has every possible option considered in its original design. Because of the insert row when not present setting, the group will insert a new record whenever the designated ID doesn't exist. Afterwards, it will update the rows in the table that are associated with the key/value references as shown in this example.
To update or insert a new row into the database
-
Create a New Standard Group.
-
Drag a group of tags into the groups Basic OPC/Group Items section.
-
Change one of the tags to be read-only by selecting Read Only from the tag's Target Name column.
-
Select the appropriate settings under the groups Action tab.
-
In the group's Action tab, in the Table action area, select the update/select radio button.
-
In addition, select the key/value pairs radio button.
-
For the Column select the database table ID column.
-
For the Value column, select the read-only tag.
-
Select Insert row when not present check box at the bottom of the Table action area.
-
-
Click Enable and do a File > Save to save the project and to start the group.
Next...