Ok, it works but it changes every storage type and not just the one that i changed.
def runAction(self, event):
#assuming that props.data is a dataset
rowId = self.props.data.getValueAt(event.row, "storage_type")
#if props.data is in JSON format then it would be
#rowId = self.props.data[event.row]["ID"]
#update database with edited data.
query = "UPDATE material_master SET {} = ? WHERE storage_type = ?".format(event.column)
args = [event.value, rowId]
system.db.runPrepUpdate(query,args)
#refresh the binding on props.data to pull in the edited data.
self.refreshBinding('props.data')
To limit and issues I am doing some "testing" on an inert table.
There is a pic below.
Here is the code, I updated all of the into to reflect this new table.
I am getting this error now:
com.inductiveautomation.ignition.common.script.JythonExecException
Traceback (most recent call last):
File "function:runAction", line 8, in
NameError: name 'self' is not defined
def runAction(self, event):
#assuming that props.data is a dataset
rowId = self.props.data.getValueAt(event.row, "new_sap_m")
#if props.data is in JSON format then it would be
#rowId = self.props.data[event.row]["ID"]
#update database with edited data.
sku = self.props.data.getValueAt(event.row,"sap_m_number")
query = "UPDATE z_dunnage_tare SET {} = ? WHERE sap_m_number = ?".format(event.column)
args = [event.value, sap_m_number]
system.db.runPrepUpdate(query,args)
#refresh the binding on props.data to pull in the edited data.
self.refreshBinding('props.data')