# Transaction groups and UDTs

**URL:** <https://forum.inductiveautomation.com/t/transaction-groups-and-udts/33824>\
**Category:** Ignition\
**Created:** [April 9, 2020, 3:23pm UTC](https://forum.inductiveautomation.com/t/transaction-groups-and-udts/33824 "2020-04-09T15:23:34Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dkylep](https://avatars.discourse-cdn.com/v4/letter/d/6de8d8/32.png) [@dkylep](https://forum.inductiveautomation.com/u/dkylep)\
**Post date:** [April 9, 2020, 3:23pm UTC](https://forum.inductiveautomation.com/t/transaction-groups-and-udts/33824/1 "2020-04-09T15:23:34Z")

</div>

My process is ‘cookie cutter’, I will have a bunch of PLCs all doing the same thing. I have 10 PLCs now and plan to have 50 in the next year.

I have an existing SQL Server database where I want to store production data (every minute) from each PLC into an existing table.

I have created a UDT for the production PLC. Do I have to create a transaction group for each of the PLCs or can I use the UDT and bind tag names?

As I continue to add PLCs I don’t want to have to keep editing the software (i.e. adding a new transaction group for each new PLC).

I’m just learning the transaction groups so maybe I missed something. Thanks

---

<div class="post-metadata">

**Author:** ![scicco](https://avatars.discourse-cdn.com/v4/letter/s/e0b2c6/32.png) [@scicco](https://forum.inductiveautomation.com/u/scicco)\
**Post date:** [April 9, 2020, 5:01pm UTC](https://forum.inductiveautomation.com/t/transaction-groups-and-udts/33824/2 "2020-04-09T17:01:39Z")

</div>

I have a similar setup and the best I came up with is exporting the transaction group’s XML, doing a find / replace based on your different instance names / tag locations, and importing the modified XML. Be careful on the path of the transaction group because it will overwrite existing ones without any warning.

You mentioned storing data every minute and transaction groups are good for scheduling something like that. But if you’re making extensive use of UDTs and can come up with a way to do your data collection through a tag event script then that script would work for every instance and eliminate the need for additional transaction groups per instance.

---

<div class="post-metadata">

**Author:** ![dkylep](https://avatars.discourse-cdn.com/v4/letter/d/6de8d8/32.png) [@dkylep](https://forum.inductiveautomation.com/u/dkylep)\
**Post date:** [April 10, 2020, 2:09pm UTC](https://forum.inductiveautomation.com/t/transaction-groups-and-udts/33824/3 "2020-04-10T14:09:46Z")

</div>

Thanks for the input @scicco, you have me contemplating both of those options. I found another thread discussing dynamically creating transactions groups. I've been thinking my way through using a script to modify an XML template and using `system.groups.loadFromFile`. But, I haven't sold myself on this yet. Keeping track of when to add (possibly remove) transactions groups seems too complicated.

> [@Dynamically-Driven Transaction Groups In SQL Bridge?](http://forum.inductiveautomation.com/t/dynamically-driven-transaction-groups-in-sql-bridge/22047/11):
>
> No update. It’s still something we want to do, but it would be part of a more fundamental rewrite of SQLBridge/transaction groups, which is a significant undertaking; certainly don’t expect it in the next few months.

I think I'm leaning toward using the tag event script. My thought is to have a new 'update' tag that is on the PLC. If it is simply a bit that switches between a 1 and a 0 I could have tag event script run when the value changes from either 0 to 1 and/or 1 to 0. I'll just have to write the SQL statements myself which shouldn't be too big of deal.

---

<div class="post-metadata">

**Author:** ![scicco](https://avatars.discourse-cdn.com/v4/letter/s/e0b2c6/32.png) [@scicco](https://forum.inductiveautomation.com/u/scicco)\
**Post date:** [April 10, 2020, 6:46pm UTC](https://forum.inductiveautomation.com/t/transaction-groups-and-udts/33824/4 "2020-04-10T18:46:00Z")

</div>

If you need to keep some kind of scheduler in addition to an update that’s driven from the PLC you could also have a “Minute” expression tag as a property of your UDT whose value is the current minute. In the value changed event of that tag you could have a bunch of if statements that check the modulus of the new value by each desired interval to equal 0. The code could get a little messy but it is flexible.

---

<div class="post-metadata">

**Author:** ![dkylep](https://avatars.discourse-cdn.com/v4/letter/d/6de8d8/32.png) [@dkylep](https://forum.inductiveautomation.com/u/dkylep)\
**Post date:** [April 13, 2020, 4:42pm UTC](https://forum.inductiveautomation.com/t/transaction-groups-and-udts/33824/5 "2020-04-13T16:42:53Z")

</div>

Thanks again, I like the idea of a ‘minute’ tag.
