# Transaction Groups with Multiple Arrays

**URL:** <https://forum.inductiveautomation.com/t/transaction-groups-with-multiple-arrays/10546>\
**Category:** Ignition\
**Created:** [September 29, 2015, 1:42pm UTC](https://forum.inductiveautomation.com/t/transaction-groups-with-multiple-arrays/10546 "2015-09-29T13:42:05Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![DSI600](https://avatars.discourse-cdn.com/v4/letter/d/ad7895/32.png) [@DSI600](https://forum.inductiveautomation.com/u/DSI600)\
**Post date:** [September 29, 2015, 1:42pm UTC](https://forum.inductiveautomation.com/t/transaction-groups-with-multiple-arrays/10546/1 "2015-09-29T13:42:05Z")

</div>

Just looking for the best route to store data from several different arrays using a transaction group.

TagA - String[200] - ReadONly  
TagB - String[200] - ReadOnly  
TagA and TagB - Concatenate into one String ( I do this with a Run Always Expression) and store this combined String into the table.  
TagD- DINT[200]  
TagE- DINT[200]  
TagF- FLOAT[200]

Also I have a Triggered expression - Doing a SQL SELECT from another table and storing that value into this table.

The Trigger is a Run Always Expression - and Looks at the TagA[xx] OR TagB[xx] for a data change to inserts the data into the table.

So the only way I can see to do this is to use 200 Transaction groups. Hoping someone out there has another idea.

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [September 29, 2015, 2:19pm UTC](https://forum.inductiveautomation.com/t/transaction-groups-with-multiple-arrays/10546/2 "2015-09-29T14:19:40Z")

</div>

I would say a [block transaction](https://support.inductiveautomation.com/usermanuals/ignition/block_group.htm) is what you’re looking for.

The main difference from the standard group is that the data is stored in a tall format instead of wide. A block\_id and row\_id column are added to further index the entries.

---

<div class="post-metadata">

**Author:** ![DSI600](https://avatars.discourse-cdn.com/v4/letter/d/ad7895/32.png) [@DSI600](https://forum.inductiveautomation.com/u/DSI600)\
**Post date:** [September 29, 2015, 5:39pm UTC](https://forum.inductiveautomation.com/t/transaction-groups-with-multiple-arrays/10546/3 "2015-09-29T17:39:29Z")

</div>

Looked at that before. But they need to be individual inserts.

I only want it to insert when TagA[1] and TagB[1] data change - to insert all of the [1] elements from the individual arrays and So on when TagA[2] and TagB[2] - insert all the [2] elements.

The block will insert all 200 elements.

---

<div class="post-metadata">

**Author:** ![AlThePal](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/althepal/32/3603_2.png) [@AlThePal](https://forum.inductiveautomation.com/u/AlThePal)\
**Post date:** [September 29, 2015, 6:01pm UTC](https://forum.inductiveautomation.com/t/transaction-groups-with-multiple-arrays/10546/4 "2015-09-29T18:01:46Z")

</div>

I think this may be one of those occasions where this is easier to do in a Gateway Event Script, probably in a timer. This gives you the ability to loop and it would be easy to write a function that’s run the appropriate amount of times, checking your trigger points, reading data from another table and writing out to your database when required.

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [September 29, 2015, 6:07pm UTC](https://forum.inductiveautomation.com/t/transaction-groups-with-multiple-arrays/10546/5 "2015-09-29T18:07:26Z")

</div>

I was thinking a buffer space and using indirect addressing. I’ve done PLC driven ring buffers in this manner.

EDIT: Where are the arrays? Are they in a PLC? In a dataset? DB Table?  
…  
Sorry… starting to sound like my kids! At least I didn’t add “Where? WHERE?” 😆

---

<div class="post-metadata">

**Author:** ![DSI600](https://avatars.discourse-cdn.com/v4/letter/d/ad7895/32.png) [@DSI600](https://forum.inductiveautomation.com/u/DSI600)\
**Post date:** [September 29, 2015, 6:58pm UTC](https://forum.inductiveautomation.com/t/transaction-groups-with-multiple-arrays/10546/6 "2015-09-29T18:58:35Z")

</div>

The arrays are in the PLC

I am doing the Ignition work only - so I don’t have access to change the PLC code.

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [September 29, 2015, 7:29pm UTC](https://forum.inductiveautomation.com/t/transaction-groups-with-multiple-arrays/10546/7 "2015-09-29T19:29:07Z")

</div>

Okay last question of the day. What version of Ignition? Then I’ll leave you alone and cogitate on this for a while.

---

<div class="post-metadata">

**Author:** ![DSI600](https://avatars.discourse-cdn.com/v4/letter/d/ad7895/32.png) [@DSI600](https://forum.inductiveautomation.com/u/DSI600)\
**Post date:** [September 29, 2015, 7:31pm UTC](https://forum.inductiveautomation.com/t/transaction-groups-with-multiple-arrays/10546/8 "2015-09-29T19:31:26Z")

</div>

I am using 7.8-RC1 - because the end result is to create a report using the new reporting module from this data.

also - not “great” at python scripting yet:)

thanks for your help.

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [October 2, 2015, 10:15am UTC](https://forum.inductiveautomation.com/t/transaction-groups-with-multiple-arrays/10546/9 "2015-10-02T10:15:57Z")

</div>

Just popping back through here to apologize. Didn’t forget you, just got slammed with a bunch of stuff here at work. Hate it when work gets in the way of fun! Hoping to find some time today to get back at it.

---

<div class="post-metadata">

**Author:** ![DSI600](https://avatars.discourse-cdn.com/v4/letter/d/ad7895/32.png) [@DSI600](https://forum.inductiveautomation.com/u/DSI600)\
**Post date:** [October 5, 2015, 1:06pm UTC](https://forum.inductiveautomation.com/t/transaction-groups-with-multiple-arrays/10546/10 "2015-10-05T13:06:12Z")

</div>

Thanks - I figured out something. Basically made a memory UDT in Ignition and wrote a data change gateway script that read the indirect arrays through a pointer and does a tag read and a tag write to my ignition UDT - that way I can use 1 transaction group.

Seems to be working fine - what it is nice is there was a pointer already in the PLC - so it is fast enough to be logging all the data so far.

---

<div class="post-metadata">

**Author:** ![DSI600](https://avatars.discourse-cdn.com/v4/letter/d/ad7895/32.png) [@DSI600](https://forum.inductiveautomation.com/u/DSI600)\
**Post date:** [November 5, 2015, 9:52pm UTC](https://forum.inductiveautomation.com/t/transaction-groups-with-multiple-arrays/10546/11 "2015-11-05T21:52:35Z")

</div>

So after some testing - the pointer in the PLC can increment pretty fast. So my code it not catching all of the data. Below is the code I am using.

#This will read the current pointer from the PLC and store it in the script variable.  
pointer = system.tag.read(“Indexer”).value  
#This will collect the array tags and use the above pointer and reads those values into the variable values.  
tags = [“TagA\_%i” % (pointer), “TagB\_%i” % (pointer), “TagC\_%i” % (pointer), “TagD\_%i” % (pointer), “TagE\_%i” % (pointer)]  
values = system.tag.readAll(tags)

#This will read in the UDT memory tag created in the tags folder.  
udttags = [“MemoryUDT/TagA”, “MemoryUDT/TagB”, “MemoryUDT/TagC”, “MemoryUDT/TagD”, “MemoryUDT/TagE”]  
#This will write the values from the above array tags into the memory UDT tag.  
system.tag.writeAll(udttags,values)  
#This sets a report trigger memory tag to be used for the transaction group  
system.tag.write(“EventTrigger”,1)

“EventTrigger” is then used in the Transaction group to store the values from the MemoryUDT to the database. This works well it is just steps 1-5 happen really quick, and the gateway script might just not be fast enough to catch the change map the UDT store the data and move on to the next pointer.

I have been trying to create a counter of some sort and use my own pointer in Ignition with no avail. Just seeing if anyone has any input on a way around this issue.
