# Named Query Failing - Root Cause Found

**URL:** <https://forum.inductiveautomation.com/t/named-query-failing-root-cause-found/23426>\
**Category:** Ignition Early Access\
**Created:** [March 18, 2019, 8:49pm UTC](https://forum.inductiveautomation.com/t/named-query-failing-root-cause-found/23426 "2019-03-18T20:49:07Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![christopher.green](https://avatars.discourse-cdn.com/v4/letter/c/b9bd4f/32.png) [@christopher.green](https://forum.inductiveautomation.com/u/christopher.green)\
**Post date:** [March 18, 2019, 8:49pm UTC](https://forum.inductiveautomation.com/t/named-query-failing-root-cause-found/23426/1 "2019-03-18T20:49:07Z")

</div>

I loaded the nightly build this morning and some button scripts that would execute a named query are now failing when they used to work. Here is the beginning of the error string.

com.inductiveautomation.ignition.common.script.JythonExecException: Traceback (most recent call last): File “”, line 10, in runAction at com.inductiveautomation.ignition.gateway.db.namedquery.NamedQueryExecutor$NamedQueryInstance.execute(NamedQueryExecutor.java:382) at com.inductiveautomation.ignition.gateway.db.namedquery.NamedQueryExecutor.execute(NamedQueryExecutor.java:148) at com.inductiveautomation.ignition.gateway.db.namedquery.GatewayNamedQueryManager.execute(GatewayNamedQueryManager.java:67) at com.inductiveautomation.ignition.gateway.script.GatewayDBUtilities.runNamedQuery(GatewayDBUtilities.java:356) 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) java.lang.Exception: java.lang.Exception: java.lang.ClassCastException: Cannot coerce value ‘[Lcom.inductiveautomation.ignition.common.model.values.QualifiedValue;@4e5ab021’ into type: class java.lang.Long

at org.python.core.Py.JavaError(Py.java:552)

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [March 18, 2019, 9:09pm UTC](https://forum.inductiveautomation.com/t/named-query-failing-root-cause-found/23426/2 "2019-03-18T21:09:51Z")

</div>

Could we get a copy of the script, or at least some insight into how the retuned value was being accessed/stored?

---

<div class="post-metadata">

**Author:** ![christopher.green](https://avatars.discourse-cdn.com/v4/letter/c/b9bd4f/32.png) [@christopher.green](https://forum.inductiveautomation.com/u/christopher.green)\
**Post date:** [March 18, 2019, 9:11pm UTC](https://forum.inductiveautomation.com/t/named-query-failing-root-cause-found/23426/3 "2019-03-18T21:11:32Z")

</div>

#get values  
dateDue = self.getSibling(‘dateDue’).props.value  
reviewType = self.getSibling(‘ddownReview’).props.value  
projectID = self.getSibling(‘ddownProject’).props.value

```
#execute Update for project
props = {'projectID':projectID, 'reviewType':reviewType, 'dateDue':dateDue}
project = system.util.getProjectName()
system.db.runNamedQuery(project, 'clientTrust/insertReviews', props)

#clear values
self.getSibling('ddownReview').props.value = -1
self.getSibling('ddownProject').props.value = -1
self.getSibling('dateDue').props.value = -1
table = self.getSibling('tblProject_0')
table.refreshBinding('props.data')
```

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [March 18, 2019, 9:18pm UTC](https://forum.inductiveautomation.com/t/named-query-failing-root-cause-found/23426/4 "2019-03-18T21:18:55Z")

</div>

And I’m assuming `system.db.runNamedQuery(project, 'clientTrust/insertReviews', props)` is line 10?

I’m betting that if you throw some logging in after getting your values you’ll find that at least one of those three values is coming back as a qualifiedValue.

Could you please try something like

```auto
logger = system.util.getLogger('QACHECK')
logger.info(projectID)
logger.info(reviewType)
logger.info(dateDue)

```

immediately after getting the values and then trigger the script. Then look at the logs and let me know what you see.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [March 18, 2019, 9:19pm UTC](https://forum.inductiveautomation.com/t/named-query-failing-root-cause-found/23426/5 "2019-03-18T21:19:53Z")

</div>

Are any of those three components bound to any other value (tag, expression)?

---

<div class="post-metadata">

**Author:** ![christopher.green](https://avatars.discourse-cdn.com/v4/letter/c/b9bd4f/32.png) [@christopher.green](https://forum.inductiveautomation.com/u/christopher.green)\
**Post date:** [March 18, 2019, 9:29pm UTC](https://forum.inductiveautomation.com/t/named-query-failing-root-cause-found/23426/6 "2019-03-18T21:29:23Z")

</div>

Ok so what I found was that the options for my reviewType dropdown (which are based off a query and transform) lost a reference to populate the value, which turned it into an object instead of a value. After I changed the transform to make value an actual value instead of an empty object, it worked just fine.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [March 18, 2019, 9:34pm UTC](https://forum.inductiveautomation.com/t/named-query-failing-root-cause-found/23426/7 "2019-03-18T21:34:31Z")

</div>

Okay, that’s what I was expecting. We did do some tweaking to how expressions and the like return/interpret/cast/coerce values, and that was probably some of the fallout.
