# How to code this expression , Using tags from plc

**URL:** <https://forum.inductiveautomation.com/t/how-to-code-this-expression-using-tags-from-plc/106822>\
**Category:** Ignition\
**Tags:** scripting\
**Created:** [May 29, 2025, 1:45pm UTC](https://forum.inductiveautomation.com/t/how-to-code-this-expression-using-tags-from-plc/106822 "2025-05-29T13:45:19Z")\
**Posts on this page:** 7\
**Page:** 2

<div class="post-metadata">

**Author:** ![Leor\_Fishman](https://avatars.discourse-cdn.com/v4/letter/l/e19adc/32.png) [@Leor\_Fishman](https://forum.inductiveautomation.com/u/Leor_Fishman)\
**Post date:** [May 29, 2025, 3:27pm UTC](https://forum.inductiveautomation.com/t/how-to-code-this-expression-using-tags-from-plc/106822/21 "2025-05-29T15:27:28Z")

</div>

wait, the thread pool is size _3_? how hefty are these threads?

---

<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 29, 2025, 3:27pm UTC](https://forum.inductiveautomation.com/t/how-to-code-this-expression-using-tags-from-plc/106822/22 "2025-05-29T15:27:47Z")

</div>

Hence the \* and the clarification below. I meant, the length of time it takes the script to run doesn't bother the script itself that is running; it couldnt care less

(I added a bit more clarification to my post in case it trips people up)

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [May 29, 2025, 3:29pm UTC](https://forum.inductiveautomation.com/t/how-to-code-this-expression-using-tags-from-plc/106822/23 "2025-05-29T15:29:41Z")

</div>

Yes, but that, I believe, is why Phil is saying it is dangerous, because the stall can result in other events being missed.

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [May 29, 2025, 3:30pm UTC](https://forum.inductiveautomation.com/t/how-to-code-this-expression-using-tags-from-plc/106822/24 "2025-05-29T15:30:46Z")

</div>

> [@Leor\_Fishman](#):
>
> how hefty are these threads?

They are standard threads.

> [@Tag Value Change Scripts: Are They Run Asynchronously?](https://forum.inductiveautomation.com/t/tag-value-change-scripts-are-they-run-asynchronously/53749/9):
>
> Yes, there’s also a thread pool of size 3 that is shared between all tag event executions. This really only matters in the case you have a lot of slow to execute scripts, as @pturmel mentioned. Sometimes it’s okay to increase this pool size, but more often it means you’ve done something wrong and should rethink your approach.

---

<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 29, 2025, 5:15pm UTC](https://forum.inductiveautomation.com/t/how-to-code-this-expression-using-tags-from-plc/106822/25 "2025-05-29T17:15:28Z")

</div>

If a valueChange event calls `system.tag.writeBlocking()`, or `system.opc.writeValues()`, and the write cannot complete immediately, it will tie up one of the three threads that are processing tag events until the write times out. If you have three tags running such events with dangerous calls, you can halt **all tag event processing** for the **entire gateway** for the length of those timeouts (typically 45 or 60 seconds).

Same with DB operations other than S&F inserts/updates, and same with network API calls. Just not safe to do within tag event scripts. **Full stop**.

---

<div class="post-metadata">

**Author:** ![Leor\_Fishman](https://avatars.discourse-cdn.com/v4/letter/l/e19adc/32.png) [@Leor\_Fishman](https://forum.inductiveautomation.com/u/Leor_Fishman)\
**Post date:** [May 30, 2025, 4:15am UTC](https://forum.inductiveautomation.com/t/how-to-code-this-expression-using-tags-from-plc/106822/26 "2025-05-30T04:15:51Z")

</div>

Is this still the case if the script calls out to a project library script? (I'm not 100% on Ignition's internal code running model)

---

<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 30, 2025, 4:18am UTC](https://forum.inductiveautomation.com/t/how-to-code-this-expression-using-tags-from-plc/106822/27 "2025-05-30T04:18:56Z")

</div>

Yes. Calling a library script doesn't change the thread the code is running within. Don't let tag events run more than a small handful of milliseconds.

[Previous page](https://forum.inductiveautomation.com/t/how-to-code-this-expression-using-tags-from-plc/106822.md?page=1)
