Making a "Dynamic" transaction group

I love transaction groups as a way to avoid writing tedious SQL methods (ugh adding new fields to insert statements…) etc and I want to use them as much as possible. I’ve come across a situation where I must use a “not so streamlined” way to do what I want.

Simple recipe system:

  1. A DB table has recipes that I want to load into PLC tag arrays for process control.
  2. I create a transaction group which is DB->OPC with a custom where clause which loads the relevant row for the destination tank.
  3. An operator presses a button which triggers the group and the DB values load into the PLC tags.

No problem, works well.

However, for every tank in the plant I have to make a unique transaction group. The reason for this is because the destination OPC tag path is static. Having the custom where clause in this case is only one half of the equation.

Now, my cogs are starting to spin and I’m thinking, can I make an “expression tag” as the destination and somehow use an expression to write to a dynamic tag path? i.e.

DB -> OPC via expression tag

“Tank”+ “DynamicNumberHere” +"_Ingredient1"

This way I can write to what ever Tank tag I want depending on the value of “DynamicNumberHere” at the time the transaction group is triggered. Meaning I can have 1 Transaction group that loads recipes to any tank I specify based on a dynamic value.

IF there is another way to do this I’m happy to hear it.

Thanks for reading

Mat Kent.

Unfortunately there isn’t a great way to do this, but I would look into using a Block Group to achieve your goals in a single group. That will allow you to set all the ingredients on every tank at the same time, but that also means that you need to find a way to select the right recipes in the right block format.

If you really need to do it all in one place, then you might have to use a tag change script for it, but then you’re giving up on transaction groups.