This lesson is part of the Transaction Groups in Ignition course. You can browse the rest of the lessons below.

Supplemental Videos

Description

Learn how to use bi-directional data synchronization to write from Tags to the database and from the database to Tags to keep a table with realtime values in the database.

Video recorded using: Ignition 8.1

Transcript

(open in window)

[00:00] A bi-directional transaction group is any transaction group that is configured to write bi-directionally from my database tool OPC or tags. In other words, it is not a group that is inserting new records or new rows into the database. Instead the bi-directional group will synchronize OPC tag data with database data. Should I tag value change OPC side, this tax new value will be written to the database. Should our value change database side, this value change will be written back to OPC. Aside from data synchronization between OPC and a database, this type of group can be useful in a number of cases. For example, if I had a third party application writing data to my database, ignition will reflect this data in OPC. Similarly, if I write to one of my OPC tags in ignition my database will reflect this change and therefore this change can be seen from any third party application, as long as it has access to my database.

[01:08] For our example, I have a basic standard transaction group created here. I will grab a few of my energy or tags from my tag browser and add them to my group. I will also add some string type tags. I will leave the execution of the default one second rate, the update mode, I will have to configure to bi-directional OPC wins. I will set the data source to be one of my gateways configure databases. Next, I will tell the group to use a table named My Data Table and press Enter. Remember because I have this setting enabled here, the group itself will automatically create this table for me, if it does not already exist in my database. Now for my table action, since this is a bi-directional group, instead of inserting a new row for every group execution, I want to set this to update select, the first record in my data table.

[02:06] I will now enable the group and save my changes. If I click on the database icon next to my table name, I will see the database query browser up here, showing you the table my group just created along with all its data. Remember this group is configured to update select the first record on this table. What does this mean? If I change one of my integer tag values, and then re-execute my query in the database query browser, you will see that my OPC tag data was written to the database. Similarly, I can change this value in the database by pressing the edit button right here. Double-clicking on the cell I wish to edit and change its value. When I press Apply, you will see that the value I wrote to the database gets written to my OPC tag, essentially synchronizing the two. Now I can continue to my tag values or change my database values, and both will always synchronize.

[03:04] Anytime a value changes in OPC or in the database, the other side would reflect this change. You may have noticed two different types of bi-directionality up here in my groups update mode. OPC wins and database wins. This allows you to control how the group will handle OPC records, not matching DB records, only on initial groups start. With OPC wins, if the group first starts, and sees OPC data does not match the database the OPC data will win and the database will be updated to match OPC. With database wins, if the group starts and sees the database data does not match OPC, the database data will win and it will be written to OPC. So bi-directional items and transaction groups are a concept that can provide a great deal of flexibility and help expose data in two different ways to outside sources. As tags in ignition, or as records inside a database.

You are editing this transcript.

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