# Tag Value Change Script gets executed multiple times

**URL:** <https://forum.inductiveautomation.com/t/tag-value-change-script-gets-executed-multiple-times/65089>\
**Category:** Ignition\
**Tags:** ignition79, scripting\
**Created:** [October 11, 2022, 9:24pm UTC](https://forum.inductiveautomation.com/t/tag-value-change-script-gets-executed-multiple-times/65089 "2022-10-11T21:24:30Z")\
**Posts on this page:** 19\
**Page:** 2

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [May 1, 2023, 8:25pm UTC](https://forum.inductiveautomation.com/t/tag-value-change-script-gets-executed-multiple-times/65089/21 "2023-05-01T20:25:05Z")

</div>

Seems like this whole thing should have been 12 UDT instances (the tags for each of the 12 lines) and 1 project, where the project is parameterized in such a way that it knows which of the 12 UDT instances it should be pointing at.

---

<div class="post-metadata">

**Author:** ![hhbauss](https://avatars.discourse-cdn.com/v4/letter/h/ecae2f/32.png) [@hhbauss](https://forum.inductiveautomation.com/u/hhbauss)\
**Post date:** [May 1, 2023, 8:26pm UTC](https://forum.inductiveautomation.com/t/tag-value-change-script-gets-executed-multiple-times/65089/22 "2023-05-01T20:26:25Z")

</div>

That is an argument that we lost (for now).

With that being said, is there any way to accomplish this using thin clients?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [May 1, 2023, 8:27pm UTC](https://forum.inductiveautomation.com/t/tag-value-change-script-gets-executed-multiple-times/65089/23 "2023-05-01T20:27:00Z")

</div>

> [@hhbauss](#):
>
> I am using Perspective

BTW, you are posting in a v7.9 topic, which doesn't have Perspective at all.

---

<div class="post-metadata">

**Author:** ![hhbauss](https://avatars.discourse-cdn.com/v4/letter/h/ecae2f/32.png) [@hhbauss](https://forum.inductiveautomation.com/u/hhbauss)\
**Post date:** [May 1, 2023, 8:29pm UTC](https://forum.inductiveautomation.com/t/tag-value-change-script-gets-executed-multiple-times/65089/24 "2023-05-01T20:29:41Z")

</div>

I did not notice this when I found this topic. I just saw that someone had a similar issue to me and I thought there was an answer out there.

I can create a new thread in the correct forum. My bad. Thanks!

---

<div class="post-metadata">

**Author:** ![hhbauss](https://avatars.discourse-cdn.com/v4/letter/h/ecae2f/32.png) [@hhbauss](https://forum.inductiveautomation.com/u/hhbauss)\
**Post date:** [May 1, 2023, 8:35pm UTC](https://forum.inductiveautomation.com/t/tag-value-change-script-gets-executed-multiple-times/65089/25 "2023-05-01T20:35:06Z")

</div>

When I tried this with one project, the lines would overpower each other with what session property it was using.

If "Line 1" launched a session, and then "Line 2" launched a session, Line 2 would overwrite the session properties of Line 1.

They are all using the same server and thin clients. Is this impossible to do using thin clients?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [May 1, 2023, 8:36pm UTC](https://forum.inductiveautomation.com/t/tag-value-change-script-gets-executed-multiple-times/65089/26 "2023-05-01T20:36:42Z")

</div>

> [@hhbauss](#):
>
> is there any way to accomplish this using thin clients?

It is a fundamental problem with terminal server setups: the terminal server is the endpoint for the network connections that the gateway sees, and therefore causes the gateway to think they are all the same client. This is true for both Vision and Perspective.

Just say no to terminal servers. If security is the driving force for using one (because Windows is unsafe to deploy--duh), deploy on Linux instead. Directly on the thin client. I strongly recommend you re-fight this battle with whomever dictated the use of the terminal server.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [May 1, 2023, 8:45pm UTC](https://forum.inductiveautomation.com/t/tag-value-change-script-gets-executed-multiple-times/65089/27 "2023-05-01T20:45:40Z")

</div>

Didn't you already figure out earlier that using Perspective Workstation solves the shared session issue?

---

<div class="post-metadata">

**Author:** ![hhbauss](https://avatars.discourse-cdn.com/v4/letter/h/ecae2f/32.png) [@hhbauss](https://forum.inductiveautomation.com/u/hhbauss)\
**Post date:** [May 1, 2023, 8:51pm UTC](https://forum.inductiveautomation.com/t/tag-value-change-script-gets-executed-multiple-times/65089/28 "2023-05-01T20:51:48Z")

</div>

Yes, but now it is the Gateway Events that are causing the issue. I need to fire a tag change script for one tag. Since each project is running off the same gateway, the script fires for all projects on the gateway. So when one tag goes high and triggers the gateway event, I get multiple duplicate entries in the SQL database matching the number of projects I have.

There is no way to have only one project fire one tag on the gateway?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [May 1, 2023, 9:10pm UTC](https://forum.inductiveautomation.com/t/tag-value-change-script-gets-executed-multiple-times/65089/29 "2023-05-01T21:10:16Z")

</div>

That's been answered. Go back and look at those answers, then look at your project inheritance setup.

---

<div class="post-metadata">

**Author:** ![hhbauss](https://avatars.discourse-cdn.com/v4/letter/h/ecae2f/32.png) [@hhbauss](https://forum.inductiveautomation.com/u/hhbauss)\
**Post date:** [May 1, 2023, 9:18pm UTC](https://forum.inductiveautomation.com/t/tag-value-change-script-gets-executed-multiple-times/65089/30 "2023-05-01T21:18:18Z")

</div>

I'm sorry, but the projects were not inherited, they are just copies of one program.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [May 1, 2023, 9:27pm UTC](https://forum.inductiveautomation.com/t/tag-value-change-script-gets-executed-multiple-times/65089/31 "2023-05-01T21:27:49Z")

</div>

> [@hhbauss](#):
>
> they are just copies of one program

😵 Go back to Kevin's suggestion and scrap all of your maybe-identical 16 projects and use a single project with udts

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [May 1, 2023, 9:27pm UTC](https://forum.inductiveautomation.com/t/tag-value-change-script-gets-executed-multiple-times/65089/32 "2023-05-01T21:27:59Z")

</div>

> [@hhbauss](#):
>
> There is no way to have only one project fire one tag on the gateway?

No. Tags are a global resource. They aren't associated with a project.

You made 12 copies of a project, each with a gateway event tag change script, which it sounds like are looking at the same tag(s).

Each time the tag(s) change, all 12 of those scripts are going to fire.

---

<div class="post-metadata">

**Author:** ![hhbauss](https://avatars.discourse-cdn.com/v4/letter/h/ecae2f/32.png) [@hhbauss](https://forum.inductiveautomation.com/u/hhbauss)\
**Post date:** [May 1, 2023, 9:41pm UTC](https://forum.inductiveautomation.com/t/tag-value-change-script-gets-executed-multiple-times/65089/33 "2023-05-01T21:41:52Z")

</div>

Thanks for all the replies. This is an eye-opening learning experience.

It appears that I have a couple issues going against me to actually get this to work with Ignition.

---

<div class="post-metadata">

**Author:** ![PRAMANJ](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pramanj/32/66935_2.png) [@PRAMANJ](https://forum.inductiveautomation.com/u/PRAMANJ)\
**Post date:** [May 2, 2023, 3:42am UTC](https://forum.inductiveautomation.com/t/tag-value-change-script-gets-executed-multiple-times/65089/34 "2023-05-02T03:42:05Z")

</div>

Instead of using UDTs perhaps you could define 12 separate Tag Providers for the 12 projects with the copy of all tags in each of them! Only problem would be any change in a tag in a project will have to be replicated in all 12 providers tags! From that point of view perhaps UDT is a better solution but perhaps difficult to implement than separate tag provider solution. (This is similar to having separate tag database for each project which gets copied along with a project being copied).

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [May 2, 2023, 3:53am UTC](https://forum.inductiveautomation.com/t/tag-value-change-script-gets-executed-multiple-times/65089/35 "2023-05-02T03:53:32Z")

</div>

12 tag providers would be the same mess as having 12 independent "identical" (until 5 years' time when they're not, but should be) projects 😬

---

<div class="post-metadata">

**Author:** ![PRAMANJ](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pramanj/32/66935_2.png) [@PRAMANJ](https://forum.inductiveautomation.com/u/PRAMANJ)\
**Post date:** [May 2, 2023, 4:40am UTC](https://forum.inductiveautomation.com/t/tag-value-change-script-gets-executed-multiple-times/65089/36 "2023-05-02T04:40:03Z")

</div>

But what if all 12 Lines (project) change in their hardware (like new equipment or PLC logic and I/O etc) individually In fact it would be easier maintain their own databases as the hardware changes take place over the period of time after initial commissioning? In fact, if you did UDT implementation then individual changes would be difficult to do in each Line (Project). Anyways its individual's choice which approach he finds intuitive and easier.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [May 2, 2023, 4:53am UTC](https://forum.inductiveautomation.com/t/tag-value-change-script-gets-executed-multiple-times/65089/37 "2023-05-02T04:53:57Z")

</div>

I still wouldn't use 12 tag providers. I would use a single tag provider and have all tags in the one. Then you can easily maintain UDT definitions once instead of 12 times which would be a logistical nightmare. (Likewise with maintaining 12x individual projects that should, for the most part, be identical; use a single project. Having multiple projects is a nightmare as you can only open 1 per Designer - of course, sometimes this makes sense if they're completely independent, but it sounds like in this case they're not)

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [May 2, 2023, 6:59am UTC](https://forum.inductiveautomation.com/t/tag-value-change-script-gets-executed-multiple-times/65089/38 "2023-05-02T06:59:51Z")

</div>

AH !

> [@pascal.fragnoud](#):
>
> You'd think (and hope).  
> But he might have 16 copies of the same project, with each update being copied to the 15 other projects.  
> I've suffered through this. Took me a year and a half to convince them to let me refactor the whole thing into a single inheritable project.

Reality does trump imagination sometimes !

---

<div class="post-metadata">

**Author:** ![PRAMANJ](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pramanj/32/66935_2.png) [@PRAMANJ](https://forum.inductiveautomation.com/u/PRAMANJ)\
**Post date:** [May 2, 2023, 12:00pm UTC](https://forum.inductiveautomation.com/t/tag-value-change-script-gets-executed-multiple-times/65089/39 "2023-05-02T12:00:35Z")

</div>

Even if they are in a single project, tag provider would still work, of course UDT could be better approach. I, being from an older generation I think in terms of flat files compared to you young generation people who think in terms of objects (UDTs)!

[Previous page](https://forum.inductiveautomation.com/t/tag-value-change-script-gets-executed-multiple-times/65089.md?page=1)
