I have an editable table that we are using to update a few alert params that have already been created. The alerts are being created fine, but when we edit an alert value from the editable table the change is reflected in the db but not in the SQL tag itself. Any ideas on what I have wrong in this update? Here is the event handler cell edited script that we’re using to do the edits:
table = event.source.parent.TableName
pk = event.source.parent.PrimaryKey
colName = event.source.data.getColumnName(event.column)
low = “low”
high = “high”
stateID = event.source.parent.selectedTagID
params = [event.newValue]
Handle the case where there are multiple primary keys
pks = [x.strip() for x in pk.split(",")]
where=""
for key in pks:
where += key + "=? AND "
remove trailing AND
where = where[:-5]
query = “UPDATE %s SET %s=? WHERE %s”% (table, colName, where)
query1 = “UPDATE %s SET %s=? WHERE %s”% (table, low, where)
query2 = “UPDATE %s SET %s=? WHERE %s”% (table, high, where)
params = [event.newValue]
for key in pks:
params.append(event.source.data.getValueAt(event.row, key))
if event.source.selectedColumn==3:
fpmi.db.runPrepStmt(query, params)
if event.source.selectedColumn==4:
fpmi.db.runPrepStmt(query1, params)
fpmi.db.runPrepStmt(query2, params)