I have a Power Table Component who’s Data Property is bound to a Named Query. Nothing Fancy a real simple query.
SELECT ndx, t_stamp AS Date, new AS New, repair AS Repair, prevent AS Prevent, inspect AS
Inspect, note
FROM maintlog
WHERE id LIKE :SelectedCell
ORDER BY t_stamp ASC
How do I run an update from this Power Table’s Component Scripting - onCellEdited?
I currently trying to use the following script.
#onCellEdited Update Query
row = rowIndex
col = colIndex
colName = colName
value = newValue
ndx = self.data.getValueAt(row,0)
query = "UPDATE maintlog SET %s = ? WHERE ndx = ?" % colName
system.db.runPrepUpdate(query,[value,ndx],'quality')
system.db.refresh(self.data)
This script has always worked for me on Power Tables when the Data property is bound to a SQL Query.
I’m not getting any error msg. When your in the client and attempt to edit a cell, it appears like everything is working. The table is simply not getting updated and the cell returns to its original state.
I have the cells set for “Editable” in the custom table properties.
As for the script, I am a complete rookie and I found this script to work when a power table is filled with a normal SQL query binding, so I have stuck with it.
Thank you for your help.
This is a little embarrassing, there must have been something wrong with our gateway last night.
Everything was working fine this morning.
I went ahead and made the change you suggested and it improved the client response time incredibly.
With my old script, the client would edit a cell, hit enter or tab out of the cell and a second or two later the change would be displayed. By changing the last line to (self, ‘data’) the client edits are reflected immediately.
Thanks again.