Updating Table with onCellEditCommit

Hello, I am having a problem trying to figure this error out. The error is:

com.inductiveautomation.ignition.common.script.JythonExecException
Traceback (most recent call last):
  File "<function:runAction>", line 4, in runAction
TypeError: 'com.inductiveautomation.ignition.gateway.datasource.BasicStreamingDataset' object is unsubscriptable

line 4 being “self.props.data[event.row][event.column] = valueToSet”

This simple script works while the table is not filtered by dropdowns; however, when filtered it will not allow the onCellEditCommit to replace the previous value. I’m assuming this is because the filtered results column/row doesn’t match up with the database column/row. The filter for the dropdowns are a simple “Select * from database where line = :line, area = :area” etc. The full table onCellEditCommit code is this:

#allows cell to be edited
valueToSet = event.value
self.props.data[event.row][event.column] = valueToSet
	
#sets edited value immediately -- otherwise have to click elsewhere to set
self.props.selection.data[0].TrainingLevel = valueToSet

I figure I better include one of my dropdowns’ change scripts as well. This is the example of the line dropdown for filtering.

Line = self.props.value

system.db.runNamedQuery("TrainingLine", {"Line" :Line})
returnedData = system.db.runNamedQuery("TrainingLine", {"Line" :Line})
self.parent.parent.getChild("Table").props.data = returnedData

After the onCellEditCommit script, I have an update button that the user will click to insert this updated value to the database. I am trying to find an alternate way of using the onCellEditCommit so that it works with the filtered dropdowns. Any tips or advice is greatly appreciated.

the problem is your data is a dataset, you cant access or set a dataset like that.
https://docs.inductiveautomation.com/display/DOC81/Datasets
https://docs.inductiveautomation.com/display/DOC81/system.dataset.setValue

Seems you did an edit…

If you get the dataset from a database you will have to do an update to the database and not just create a new dataset

https://docs.inductiveautomation.com/display/DOC81/system.db.runPrepUpdate

Sorry for the confusion, it’s hard to type these kinds of things out and this is my first forum post. That query is just to filter the line on the table to the selected input value on the line dropdown. I have an update button that runs the prep update.

update = "UPDATE Badge_Read_Training_Level SET TrainingLevel = ? WHERE Name = ? and Line = ? and Area = ? and Job = ?"
system.db.runPrepUpdate(update, args)

However this can’t go through unless the dataset is unfiltered. The filtering creates a new dataset and that is where the problem lies?

Also thank you very much for the help. I’m currently researching the links you sent.

I still am not sure i understand where all your functions go…

But try this
self.props.data = system.dataset.setValue(self.props.data, event.row , event.column,valueToSet)

saludos estoy configurando una tabla con onCellEdited uso la versión 7.9 este es mi código

row = rowIndex
col = colIndex
colName = colName

ID = self.data.getValueAt(rowIndex,'id')
query = "UPDATE AguaControl.Agua SET %s = ? WHERE id = ?" %(colName)
system.db.runPrepUpdate (query,ID,'AguaControl')
system.db.refresh(self,"data")

pero no me funciona no se donde esta el error podrian ayudarme