I am trying to run this script and I do not understand what the error it gives me. I have listed the error below.
data = system.db.runPrepQuery
(“SELECT ManufacturerUPC, ProductUPC, LabelDesc, Shift, ScaleLine, PalletID, NetWeight, PalletCount, BoxCount, ProductionDate, CompanyCode, SortBy, AddDate FROM tblProductionCounts Where (ScaleLine LIKE ‘041’ or ScaleLine LIKE ‘042’ or ScaleLine LIKE ‘073’) and PalletID = ‘Total’”,[],“Accusort”)
#print data
for row in data:
col1 = row[0]
col2 = row[1]
col3 = row[2]
col4 = row[3]
col5 = row[4]
col6 = row[5]
col7 = row[6]
col8 = int(row[7])
col9 = long(row[8])
col10 = row[9]
col11 = row[10]
col12 = int(row[11])
col13 = row[12]
my_row = “’%s’,’%s’,’%s’,’%s’,’%s’,’%s’,’%s’,%d,%d,’%s’,’%s’,%d,’%s’” %(col1,col2,col3,col4,col5,col6,col7,col8,col9,col10,col11,col12,col13)
stmt = “INSERT INTO Prodotrak_Data (ManufacturerUPC, ProductUPC, LabelDesc, Shift, ScaleLine, PalletID, NetWeight, PalletCount, BoxCount, ProductionDate, CompanyCode, SortBy, AddDate) VALUES (” + my_row + “)”
print stmt
system.db.runPrepUpdate(stmt,[],“JMCProcess”)
trunc_row = my_row[0:-2]
query = "INSERT INTO Prodotrak_Data VALUES " + trunc_row
#print query
system.db.runUpdateQuery(query, “jmcprocess”)
[color=#FF0040]ERROR [ActionAdapter-AWT-EventQueue-2] Error executing script for event: mouseClicked
on component: Button
.
Traceback (most recent call last):
File “event:mouseClicked”, line 10, in
TypeError: ‘com.inductiveautomation.ignition.common.script.ScriptManager$ReflectedInstanceFunction’ object is not iterable
at org.python.core.Py.TypeError(Py.java:235)
at org.python.core.PyObject.__iter__(PyObject.java:798)
at org.python.pycode._pyx220.f$0(<event:mouseClicked>:31)
at org.python.pycode._pyx220.call_function(<event:mouseClicked>)
at org.python.core.PyTableCode.call(PyTableCode.java:165)
at org.python.core.PyCode.call(PyCode.java:18)
at org.python.core.Py.runCode(Py.java:1275)
at com.inductiveautomation.ignition.common.script.ScriptManager.runCode(ScriptManager.java:554)
at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.runActions(ActionAdapter.java:155)
at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.invoke(ActionAdapter.java:266)
at com.inductiveautomation.factorypmi.application.binding.action.RelayInvocationHandler.invoke(RelayInvocationHandler.java:55)
at com.sun.proxy.$Proxy17.mouseClicked(Unknown Source)
at java.awt.AWTEventMulticaster.mouseClicked(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)