Named Query Issues with Script

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.

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!

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:

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

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

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

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

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