# Named Queries VARCHAR Error

**URL:** <https://forum.inductiveautomation.com/t/named-queries-varchar-error/90307>\
**Category:** Ignition\
**Created:** [May 13, 2024, 1:41pm UTC](https://forum.inductiveautomation.com/t/named-queries-varchar-error/90307 "2024-05-13T13:41:08Z")\
**Posts on this page:** 5\
**Page:** 2

<div class="post-metadata">

**Author:** ![Jack\_Jones](https://avatars.discourse-cdn.com/v4/letter/j/df788c/32.png) [@Jack\_Jones](https://forum.inductiveautomation.com/u/Jack_Jones)\
**Post date:** [May 14, 2024, 10:40am UTC](https://forum.inductiveautomation.com/t/named-queries-varchar-error/90307/21 "2024-05-14T10:40:25Z")

</div>

> [@pascal.fragnoud](#):
>
> Create a function in the script library, and call it from the event.

Does this not still use the tag threads? (not sure what the technical term is for them). When calling from the library it still takes the same amount of time whether it's defined outside and called or defined inside and called correct?

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [May 14, 2024, 11:01am UTC](https://forum.inductiveautomation.com/t/named-queries-varchar-error/90307/22 "2024-05-14T11:01:05Z")

</div>

My understanding is that the tag fires off the script from the library and lets go.

Phil has posted on this sort of issue many times. Here's one related post: [Tag change script thread mode - #2 by pturmel](https://forum.inductiveautomation.com/t/tag-change-script-thread-mode/47333/2).

---

<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 14, 2024, 11:44am UTC](https://forum.inductiveautomation.com/t/named-queries-varchar-error/90307/23 "2024-05-14T11:44:07Z")

</div>

> [@Jack\_Jones](#):
>
> Does this not still use the tag threads?

Yes. Calling a library function doesn't change what thread is running. It's just a library. If from a tag event, it is still using the limited thread pool. If from a gateway tag change event, it is still occupying that one dedicated thread.

---

<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 14, 2024, 11:46am UTC](https://forum.inductiveautomation.com/t/named-queries-varchar-error/90307/24 "2024-05-14T11:46:39Z")

</div>

> [@Transistor](#):
>
> fires off the script from the library and lets go.

No. You might be confusing libraries with the technique I recommend in this topic:

> [@Java concurrent queue for tag change scripts](https://forum.inductiveautomation.com/t/java-concurrent-queue-for-tag-change-scripts/82044):
>
> Continuing the discussion from [[SOLVED] Are tag Value Changed scripts running asynchronously?](https://forum.inductiveautomation.com/t/solved-are-tag-value-changed-scripts-running-asynchronously/68704/5): We've got code in our standard library that I need to log a value change on a tag and then associate various data points with that value change. The value is located in a UDT, and because this is part of our "standard" library we use for our customers, the number of tags is variable and quite possibly numerous so having a gateway tag event script isn't feasible for this solution. I was reading up on …

Using `queueUtil` **does** push the work out of the tag event thread pool.

---

<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 14, 2024, 1:24pm UTC](https://forum.inductiveautomation.com/t/named-queries-varchar-error/90307/25 "2024-05-14T13:24:23Z")

</div>

I'm not suggesting you call it from a tag script, but from the gateway event.  
You shouldn't put too much code in a gateway event, or you'll run into weird scoping behavior. So write your script as a library function where you won't have those issues.

[Previous page](https://forum.inductiveautomation.com/t/named-queries-varchar-error/90307.md?page=1)
