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

  1. Create a New Standard Group.

  2. Drag a group of tags into the groups Basic OPC/Group Items section.

  3. Change one of the tags to be read-only by selecting Read Only from the tag's Target Name column.

  4. Select the appropriate settings under the groups Action tab.

  5. In the group's Action tab, in the Table action area, select the update/select radio button.

  6. In addition, select the key/value pairs radio button.

    1. For the Column select the database table ID column.

    2. For the Value column, select the read-only tag.

    3. Select Insert row when not present check box at the bottom of the Table action area.

  7. Click Enable and do a File > Save to save the project and to start the group.

Next...