Named Query Failing - Root Cause Found

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)

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

#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')

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

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.

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

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.

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.