Update or Insert Group
Update or Insert Group
Watch the videoYou 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.
Update or Insert a New Row into the Database​
In the Project Browser, right-click on Transaction Groups and select New Standard Group.
Give the group a name and click Create 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.
In the group's Action tab, in the Table action area, select the update/select radio button and the key/value pairs radio button.
Click the Add () icon.
- 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.
Select the group, and click Enabled.
Save the project to start the group.