See an example of how to create a group that updates a row in the database based on an ID. Because of the "Insert row when not present" setting, the group will insert a new record whenever the current ID doesn't already exist.

Video recorded using: Ignition 7.9


(open in window)

[00:00] Transaction Groups are normally used to insert or update a particular row. However, it's also possible to use them in a manner that will update a row, or insert a new row if a specified key combination is not present. So, for example, we could create a new standard Group, and bring in some tags that represent the current Values of a particular Batch. To get the table created, we'll give it a name, and I'll enable it one time set to update the first row just to create all of the columns. With that done, I can pause a group, and I'll set the Batch ID to be Read Only because we want to use it in our WHERE clause, but we don't necessarily need to write new data to the column. Back in the Table action section, we'll select key/value pairs. This is where we'll map the Column Batch ID to a Value, in this case, the Batch ID tag. Now we'll select this option below that says, "Insert row when not present." This option works with any number of parameters in the key/value pair table. So, you can have multiple dynamic values, and the group would insert a new row anytime any of the values changed. We'll see it in action with a single value. Now we run the group, and take a look at the database. We'll see that there's one row inserted for our Batch ID zero. If we modify our Batch ID and the tag value, a new row will be inserted on the next execution, and it will become the target of the impeding values. This simple example shows how you can create a group that can dynamically track part numbers, batch numbers, bar codes, or anything where you have dynamic values associated with a changing ID.

You are editing this transcript.

Make any corrections to improve this transcript. We'll review any changes before posting them.