# FIFO anyone? (more characters to meet the 15 character limit)

**URL:** <https://forum.inductiveautomation.com/t/fifo-anyone-more-characters-to-meet-the-15-character-limit/33987>\
**Category:** Ignition\
**Created:** [April 16, 2020, 8:12pm UTC](https://forum.inductiveautomation.com/t/fifo-anyone-more-characters-to-meet-the-15-character-limit/33987 "2020-04-16T20:12:17Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![twstevic](https://avatars.discourse-cdn.com/v4/letter/t/a183cd/32.png) [@twstevic](https://forum.inductiveautomation.com/u/twstevic)\
**Post date:** [April 16, 2020, 8:12pm UTC](https://forum.inductiveautomation.com/t/fifo-anyone-more-characters-to-meet-the-15-character-limit/33987/1 "2020-04-16T20:12:17Z")

</div>

I have some Tag ‘Value Change’ event scripts. When the tag goes high, the change script passes its tag name to a shared script that reads a row of data out of a database table and then inserts the line into another table.

This works fine except for one important issue. If two (or more) tag values go high at the same time, all events may or may not be triggered. I have simulated the behavior using 4 tag values and I can repeatedly catch the result being only 3 of the 4 scripts being executed.

Is there a way to put the event scripts (with each tag name) in a FIFO arrangement so that all events are processed?

Or, is there a way to set a flag that pauses the update script if another one is in process? (If tag = high and flag = low, execute script script, if tag = high and flag = high, wait)

Or a way I can step through the tag list and when one tag value is high and has not been processed, process the event then step to the next tag?

Does the alarm subsystem handle events differently? Can I leverage that?

I asked about running the scripts from a Gateway scope, but the answer was that two values going high at the same time = one script execution.

---

<div class="post-metadata">

**Author:** ![MMaynard](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmaynard/32/3366_2.png) [@MMaynard](https://forum.inductiveautomation.com/u/MMaynard)\
**Post date:** [April 16, 2020, 8:19pm UTC](https://forum.inductiveautomation.com/t/fifo-anyone-more-characters-to-meet-the-15-character-limit/33987/2 "2020-04-16T20:19:40Z")

</div>

If you have the SFC module I would go that route.

---

<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:** [April 16, 2020, 8:28pm UTC](https://forum.inductiveautomation.com/t/fifo-anyone-more-characters-to-meet-the-15-character-limit/33987/3 "2020-04-16T20:28:51Z")

</div>

> [@twstevic](#):
>
> I asked about running the scripts from a Gateway scope, but the answer was that two values going high at the same time = one script execution.

Hmm, what now?

---

<div class="post-metadata">

**Author:** ![twstevic](https://avatars.discourse-cdn.com/v4/letter/t/a183cd/32.png) [@twstevic](https://forum.inductiveautomation.com/u/twstevic)\
**Post date:** [April 17, 2020, 10:40am UTC](https://forum.inductiveautomation.com/t/fifo-anyone-more-characters-to-meet-the-15-character-limit/33987/4 "2020-04-17T10:40:04Z")

</div>

MMaynardUSG  
And do what, loop through each tag?

---

<div class="post-metadata">

**Author:** ![twstevic](https://avatars.discourse-cdn.com/v4/letter/t/a183cd/32.png) [@twstevic](https://forum.inductiveautomation.com/u/twstevic)\
**Post date:** [April 17, 2020, 10:43am UTC](https://forum.inductiveautomation.com/t/fifo-anyone-more-characters-to-meet-the-15-character-limit/33987/5 "2020-04-17T10:43:38Z")

</div>

Kevin.Herron  
Email response -\> “I believe the gateway tag change script just taps into the listener already in place on every tag that checks for value changes. There would be minimal impact to performance if it all. _ **If the tags do change at the same time, as long as they are in the same set of tags being watched by the script, there will only be one execution.** _ However, if one tag changes and the script finishes execution, then another tag change happens the script will execute again regardless of how recently the previous script executed.”

---

<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:** [April 17, 2020, 11:53am UTC](https://forum.inductiveautomation.com/t/fifo-anyone-more-characters-to-meet-the-15-character-limit/33987/6 "2020-04-17T11:53:45Z")

</div>

I’m confused. Are these value change tag events (defined on the tag), or gateway tag change events (defined as a gateway script with a list of tags to monitor)?

I have applications with hundred-plus tags monitored by a single script of the latter type, and nary a missed event. The event object contains a reference to the triggering tag, so the script can distinguish them.

---

<div class="post-metadata">

**Author:** ![twstevic](https://avatars.discourse-cdn.com/v4/letter/t/a183cd/32.png) [@twstevic](https://forum.inductiveautomation.com/u/twstevic)\
**Post date:** [April 17, 2020, 12:19pm UTC](https://forum.inductiveautomation.com/t/fifo-anyone-more-characters-to-meet-the-15-character-limit/33987/7 "2020-04-17T12:19:24Z")

</div>

The question was about Gateway Tag value change events. Each tag value change triggers a shared script that does an SQL query. The query has the tag name passed to it, so the SQL queries are different for each tag. For the project I am currently working on, there would be several hundred events. But future larger installations may have 10,000 or so events.

I have tried using a value change on each tag, but testing with only 4 tags I would routinely get missed events. I am now trying to call the the scripts by setting an alarm and then using ‘Alarm Active’ and ‘Alarm Cleared’ events. This looks promising so far. However, using a Gateway tag change would be cleaner, I think.

---

<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:** [April 17, 2020, 12:41pm UTC](https://forum.inductiveautomation.com/t/fifo-anyone-more-characters-to-meet-the-15-character-limit/33987/8 "2020-04-17T12:41:01Z")

</div>

Whoever you were talking to in support is simply wrong about this. All 4 tag change scripts execute without regard to the timing of the value change.

The only time a script execution doesn’t happen is when you are using _tag event scripts_ (the ones defined directly on each tag), and that tag value changes more than 5 times while the current instance of the script is still executing. Script execution for reach tag get queued up but there is a limit to the queue size.

None of this applies to the kind of tag change scripts you’re talking about, and doesn’t matter anyway because you’re talking about 4 different tags changing.

---

<div class="post-metadata">

**Author:** ![twstevic](https://avatars.discourse-cdn.com/v4/letter/t/a183cd/32.png) [@twstevic](https://forum.inductiveautomation.com/u/twstevic)\
**Post date:** [April 17, 2020, 3:39pm UTC](https://forum.inductiveautomation.com/t/fifo-anyone-more-characters-to-meet-the-15-character-limit/33987/9 "2020-04-17T15:39:47Z")

</div>

Four tags was simply my test setup. The current system I am working with will have several hundred tags, larger systems in the future may have 10,000+ tags to keep track of. I know that in practice, all of the tags will never change state at the same time. This is more of a cover all the bases thing for me.

I attempted to move the tag change events to trigger off an alarm, but I still lost some events (testing with 50 tag changes at the same time). The Alarm Journal captured the alarm but the shared script did not always run.

I will now test the Gateway Tag change. It is coming up on crunch time for this project.

---

<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:** [April 17, 2020, 4:01pm UTC](https://forum.inductiveautomation.com/t/fifo-anyone-more-characters-to-meet-the-15-character-limit/33987/10 "2020-04-17T16:01:27Z")

</div>

It doesn’t matter how many tags change at once, all the scripts should execute. How were you determining they weren’t?

I’ve got 1000 tags set up to change simultaneously and I am seeing 1000 script executions each time they change.

---

<div class="post-metadata">

**Author:** ![twstevic](https://avatars.discourse-cdn.com/v4/letter/t/a183cd/32.png) [@twstevic](https://forum.inductiveautomation.com/u/twstevic)\
**Post date:** [April 17, 2020, 4:09pm UTC](https://forum.inductiveautomation.com/t/fifo-anyone-more-characters-to-meet-the-15-character-limit/33987/11 "2020-04-17T16:09:59Z")

</div>

This is from the database entries

‘30’, ‘SCADA\_ALARM\_CP01\_1\_13’, ‘ALM0100113’, ‘1’, ‘SPARE’, ‘CP01’,  
**Missing SCADA\_ALARM\_CP01\_1\_14**  
‘31’, ‘SCADA\_ALARM\_CP01\_1\_15’, ‘ALM0100115’, ‘1’, ‘SPARE’, ‘CP01’,  
‘32’, ‘SCADA\_ALARM\_CP01\_2\_0’, ‘ALM0100200’, ‘1’, ‘SPARE’, ‘CP01’,

‘35’, ‘SCADA\_ALARM\_CP01\_2\_3’, ‘ALM0100203’, ‘1’, ‘SPARE’, ‘CP01’,  
‘36’, ‘SCADA\_ALARM\_CP01\_2\_4’, ‘ALM0100204’, ‘1’, ‘SPARE’, ‘CP01’,  
**Missing SCADA\_ALARM\_CP01\_2\_5**  
‘37’, ‘SCADA\_ALARM\_CP01\_2\_6’, ‘ALM0100206’, ‘1’, ‘SPARE’, ‘CP01’,  
‘38’, ‘SCADA\_ALARM\_CP01\_2\_7’, ‘ALM0100207’, ‘1’, ‘SPARE’, ‘CP01’,

---

<div class="post-metadata">

**Author:** ![twstevic](https://avatars.discourse-cdn.com/v4/letter/t/a183cd/32.png) [@twstevic](https://forum.inductiveautomation.com/u/twstevic)\
**Post date:** [April 17, 2020, 7:40pm UTC](https://forum.inductiveautomation.com/t/fifo-anyone-more-characters-to-meet-the-15-character-limit/33987/12 "2020-04-17T19:40:03Z")

</div>

Mr. Herron,  
I just turned on 300 tags with out a miss. Thank you so much.

---

<div class="post-metadata">

**Author:** ![carolina\_elfeky](https://avatars.discourse-cdn.com/v4/letter/c/8baadc/32.png) [@carolina\_elfeky](https://forum.inductiveautomation.com/u/carolina_elfeky)\
**Post date:** [June 30, 2021, 2:30pm UTC](https://forum.inductiveautomation.com/t/fifo-anyone-more-characters-to-meet-the-15-character-limit/33987/13 "2021-06-30T14:30:26Z")

</div>

How did you resolve this issue? I’m having the same thing happen. If I use only 1 tag, no missed events. But once I turn more tags on, then I start seeing a missed event on each tag.
