Move data from MSSQL to Allen Bradley PLC tag

I use Transaction Groups to move data from the PLC to a MSSQL database, but I would like to grab info from a table using a Name query to grab a single bit of data and then move that to a tag on an Allen Bradley PLC.

If this is possible how would I go about doing this?

It is possible.

Does the value need to move outside of user interaction? Is there some type of trigger?

The value would change based on a PLC tag.

Ideally the workflow would be

  1. Part present (trigger)
  2. Database sends info over (the value changes on each part present)
  3. PLC has info.
  4. PLC then sends data back to Database

You're already using transaction groups. Can't you just set the update mode to "DB to OPC" for the part where the database is writing to the PLC?


I have the named query setup to grab the data. So I know that part works. Im just not sure how to use a PLC tag as a trigger to use that script to send the data over to the PLC.

Illustrating @Steve_Laubach's answer:

Yes I understand that part. I guess I just need a little hand holding as far as what to do to make that work.

I have DB to PLC

Datasource : My server
Table name: The Table Im using

and then for a trigger I have Part Present from the PLC, but from there Im not really sure where to go.

Have the part present tag from the PLC as a read only OPC item in the transaction group, and then set the transaction group to trigger on that tag.

This is a table I created and used in another thread, called totalizer.

I've now made three tags to coincide with the table column names

Let's say that i want to update the values of total and gpm using the value of ndx. This is how the transaction group could be set up.

Now, changes in the ndx tag updates the other two values.

Use of a trigger would probably work better, and, IMO, a handshake should be in there as well.

So in the Table Actions section where you have Update/Select

The column would be what the table is doing and the value would be the data that's moving to the PLC tag?

I need to run a Named Query so that I can get a specific value from the table thats rather large not just whatever is the top value in that column.

My example shows a key/value pair to work as a WHERE clause. In this instance WHERE ndx = {ndxTag}.

If you are wanting to use a named query then a transaction group is not what you want to use. That would require a script and a gateway tag change event.