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:
- A DB table has recipes that I want to load into PLC tag arrays for process control.
- I create a transaction group which is DB->OPC with a custom where clause which loads the relevant row for the destination tank.
- 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