# Gateway Tag Change Script with UDTs

**URL:** <https://forum.inductiveautomation.com/t/gateway-tag-change-script-with-udts/93559>\
**Category:** Ignition\
**Tags:** scripting\
**Created:** [July 22, 2024, 7:24pm UTC](https://forum.inductiveautomation.com/t/gateway-tag-change-script-with-udts/93559 "2024-07-22T19:24:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cade\_Allen](https://avatars.discourse-cdn.com/v4/letter/c/db5fbb/32.png) [@Cade\_Allen](https://forum.inductiveautomation.com/u/Cade_Allen)\
**Post date:** [July 22, 2024, 7:24pm UTC](https://forum.inductiveautomation.com/t/gateway-tag-change-script-with-udts/93559/1 "2024-07-22T19:24:50Z")

</div>

I have several UDT instances that represent lighting panels, and each has 30 departments (also UDTs) with their own schedule data, both from the PLC, as well as query tags from the database.

I need to sync the schedules between the PLC and DB when a local schedule change is made at the PLC. Initially, I used tag change scripts to run named queries and update the table, but this doesn't seem like a good idea, especially with so many tags.

What's the best way to handle this? With a Gateway Tag Change script, would I have to specify the paths for every single tag to be monitored? I tried monitoring just the UDTs, but I don't know if I can get the path of the lower level tag that changed from the event object.

The structure of my UDT is:

- Lighting Panel 1
- Department\_1
  - DB\_Schedule
    - On\_Hour
    - Off\_Hour

  - Panel\_Schedule
    - On\_Hour
    - Off\_Hour  
...

---

<div class="post-metadata">

**Author:** ![franklepkowski](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/franklepkowski/32/4808_2.png) [@franklepkowski](https://forum.inductiveautomation.com/u/franklepkowski)\
**Post date:** [July 23, 2024, 2:02am UTC](https://forum.inductiveautomation.com/t/gateway-tag-change-script-with-udts/93559/2 "2024-07-23T02:02:21Z")

</div>

Have you considered using bidirectional transaction groups? They could be set to execute on tag changes.

Frank

---

<div class="post-metadata">

**Author:** ![Cade\_Allen](https://avatars.discourse-cdn.com/v4/letter/c/db5fbb/32.png) [@Cade\_Allen](https://forum.inductiveautomation.com/u/Cade_Allen)\
**Post date:** [July 23, 2024, 1:29pm UTC](https://forum.inductiveautomation.com/t/gateway-tag-change-script-with-udts/93559/3 "2024-07-23T13:29:18Z")

</div>

> [@franklepkowski](#):
>
> bidirectional transaction groups

I'll give that a shot!
