# Named Query Issues with Script

**URL:** <https://forum.inductiveautomation.com/t/named-query-issues-with-script/61569>\
**Category:** Ignition\
**Tags:** namedqueries, ignition80, scripting, perspective\
**Created:** [July 6, 2022, 3:21pm UTC](https://forum.inductiveautomation.com/t/named-query-issues-with-script/61569 "2022-07-06T15:21:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Raymond\_Sipes](https://avatars.discourse-cdn.com/v4/letter/r/4491bb/32.png) [@Raymond\_Sipes](https://forum.inductiveautomation.com/u/Raymond_Sipes)\
**Post date:** [July 6, 2022, 3:21pm UTC](https://forum.inductiveautomation.com/t/named-query-issues-with-script/61569/1 "2022-07-06T15:21:48Z")

</div>

Hello, all!

I have a named query that takes in two parameters, a Float4 and String. I am trying to get the DB to update once this button is pressed with a value from a tag. When I go to the testing tab for the named query, it gives a 1, which tells me the params seems to be in working order.

Although, once I add this to the actionPerformed event, this is where the errors start to come in. I get this error message once I try to run it with the button: `caused by Exception: java.sql.SQLException: Transaction "{'PC': 50.0}" is closed. caused by SQLException: Transaction "{'PC': 50.0}" is closed.`

This makes me believe this is being caused with my script, which I will also paste below.

```auto
system.db.runNamedQuery('Query_Name', 'RefreshChangesFromCurrentCircuit Start Button Formation', {"WO_ID": str(self.getSibling("Label_7").props.text)} , {"PC": (self.getSibling("NumericEntryField_0").props.value)})

```

Any help with this would be greatly appreciated!

---

<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:** [July 6, 2022, 3:28pm UTC](https://forum.inductiveautomation.com/t/named-query-issues-with-script/61569/2 "2022-07-06T15:28:47Z")

</div>

Your parameter dictionary is not correct, and you are passing an extra value to the function that I don’t know what the intention is. It should be:

```auto
system.db.runNamedQuery('Query_Name', {"WO_ID": str(self.getSibling("Label_7").props.text) , "PC": (self.getSibling("NumericEntryField_0").props.value)})
```

---

<div class="post-metadata">

**Author:** ![jpark](https://avatars.discourse-cdn.com/v4/letter/j/a88e57/32.png) [@jpark](https://forum.inductiveautomation.com/u/jpark)\
**Post date:** [July 6, 2022, 3:28pm UTC](https://forum.inductiveautomation.com/t/named-query-issues-with-script/61569/3 "2022-07-06T15:28:57Z")

</div>

> [@Raymond\_Sipes](#):
>
> ` {"WO_ID": str(self.getSibling("Label_7").props.t`

You are passing in the parameters as two separate parameters.  
Combine them into one.

```auto
{"WO_ID": str(self.getSibling("Label_7").props.text),
"PC": (self.getSibling("NumericEntryField_0").props.value)}

```

---

<div class="post-metadata">

**Author:** ![Raymond\_Sipes](https://avatars.discourse-cdn.com/v4/letter/r/4491bb/32.png) [@Raymond\_Sipes](https://forum.inductiveautomation.com/u/Raymond_Sipes)\
**Post date:** [July 6, 2022, 3:31pm UTC](https://forum.inductiveautomation.com/t/named-query-issues-with-script/61569/4 "2022-07-06T15:31:25Z")

</div>

That was it! Thank you so much for the quick response!

---

<div class="post-metadata">

**Author:** ![Raymond\_Sipes](https://avatars.discourse-cdn.com/v4/letter/r/4491bb/32.png) [@Raymond\_Sipes](https://forum.inductiveautomation.com/u/Raymond_Sipes)\
**Post date:** [July 6, 2022, 3:31pm UTC](https://forum.inductiveautomation.com/t/named-query-issues-with-script/61569/5 "2022-07-06T15:31:44Z")

</div>

Thank you! That was it, have a great day!
