# Named Query Transaction

**URL:** <https://forum.inductiveautomation.com/t/named-query-transaction/85189>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [February 3, 2024, 7:44pm UTC](https://forum.inductiveautomation.com/t/named-query-transaction/85189 "2024-02-03T19:44:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fernando\_Lopez](https://avatars.discourse-cdn.com/v4/letter/f/b38774/32.png) [@Fernando\_Lopez](https://forum.inductiveautomation.com/u/Fernando_Lopez)\
**Post date:** [February 3, 2024, 7:44pm UTC](https://forum.inductiveautomation.com/t/named-query-transaction/85189/1 "2024-02-03T19:44:30Z")

</div>

Hello, I have a problem with the transaction of a named query, this is my code in perspective:

txId1 = system.db.beginNamedQueryTransaction(project="ferprueba", datasource="JasmineDB", timeout=5000)  
system.db.runNamedQuery("InsertReport", {"AREA": area, "NOTE": note, "PET": pet}, tx = txId1)

This is the error:  
com.inductiveautomation.ignition.common.script.JythonExecException: Traceback (most recent call last): File "", line 21, in runAction File "", line 21, in runAction at com.inductiveautomation.ignition.gateway.script.GatewayDBUtilities.lambda$runNamedQuery$0(GatewayDBUtilities.java:412) at java.base/java.util.Optional.orElseThrow(Unknown Source) at com.inductiveautomation.ignition.gateway.script.GatewayDBUtilities.runNamedQuery(GatewayDBUtilities.java:412) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.base/java.lang.reflect.Method.invoke(Unknown Source) com.inductiveautomation.ignition.common.project.ProjectNotFoundException: com.inductiveautomation.ignition.common.project.ProjectNotFoundException: project not found: InsertReport

---

<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:** [February 3, 2024, 8:55pm UTC](https://forum.inductiveautomation.com/t/named-query-transaction/85189/2 "2024-02-03T20:55:33Z")

</div>

You’re calling `system.db.runNamedQuery()` in a Gateway Scope, so you must provide a project name. The error is stating that it can’t find the project. I suspect that you have left out the project name and InsertReport is the name of your query.

---

<div class="post-metadata">

**Author:** ![Fernando\_Lopez](https://avatars.discourse-cdn.com/v4/letter/f/b38774/32.png) [@Fernando\_Lopez](https://forum.inductiveautomation.com/u/Fernando_Lopez)\
**Post date:** [February 4, 2024, 12:05am UTC](https://forum.inductiveautomation.com/t/named-query-transaction/85189/3 "2024-02-04T00:05:09Z")

</div>

Thank you. I had to add the project name to the system.db.runNamedQuery function:  
system.db.runNamedQuery("ferprueba", "InsertReport", {"AREA": area, "NOTE": note, "PET": pet}, tx = txId1)

---

<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:** [February 4, 2024, 4:10am UTC](https://forum.inductiveautomation.com/t/named-query-transaction/85189/4 "2024-02-04T04:10:52Z")

</div>

Welcome to the forum, Fernando. For future posts please see [Wiki - how to post code on this forum](https://forum.inductiveautomation.com/t/wiki-how-to-post-code-on-this-forum/77831).
