7.8 Transaction Mgr write a SQL query result to tags in PLC

I am trying to write the results of a SQL query into PLC tags based on the value of a trigger tag changing.

This is being used in a batch process and I am logging additions of each batch to a table in the DB. When the operator switches between batches the batch number is being changed in the PLC. When this happens I want to query the DB to sum the total of batches to that point in the process. The reason for this is there are multiple batches being worked on at the same station

I have a working query in the query browser that is returning a single row of totals that I want to use. Where I am failing is how to write those values to a set of tags in the PLC.

Ok, I worked through the answer but will post it here in case someone else has the same problem.

The solution I used was to create a stored procedure on the database with output parameters for each of the tags that I wanted to write to. I set the parameters equal to each selected sum. I was then able to set each tag equal to the output parameter in a stored procedure transaction group.