Hey all,
I am running a script from a button event, that sends a message to the root container, which runs a named query, and inserts a few values into the DB.
I am trying to test the system.db.beginNamedQueryTransaction
because I am trying to run multiple update queries back-to-back in a new project, but for some reason I only get a few updates (out of 27) to run successfully.
In this test, this is the query:
INSERT INTO [dbo].[Table_3] ([F1], [F2], [F3])
VALUES (:p_1, :p_2, :p_3 )
This is the message handler: (`test01')
def onMessageReceived(self, payload):
# implement your handler here
query = 'Coater/Test01'
p1 = self.getChild("NumericEntryField").props.value
p2 = self.getChild("NumericEntryField_0").props.value
p3 = self.getChild("TextField").props.text
params = {'p_1':p1, 'p_2':p2, 'p_3':p3}
proj = 'Sandbox_Sample'
db = 'IGNSVR_Dev'
tx = ''
tx = system.db.beginNamedQueryTransaction(proj, db, 2)
system.db.runNamedQuery(query, params, tx)
system.db.commitTransaction(tx)
(I removed the closeTransaction to see if anything would change...)
This is the button event script:
def runAction(self, event):
msg = 'test01'
payload = {}
system.perspective.sendMessage(msg, payload)
This is the gist of the error:
com.inductiveautomation.ignition.common.script.JythonExecException: Traceback (most recent call last): File "", line 23, in onMessageReceived at ...
java.lang.ClassCastException: java.lang.ClassCastException:
Cannot coerce value '90da8353-ce17-42a0-852e-65506aacc7d2' into type: interface java.util.Map
I've read a few other threads and the docs and it appears the args for Perspective scope are correct.
Any ideas?