I have a table which it’s dataset is bound to an SQL table. I’ve created a button to insert data into the SQL table, and as a result the table in Ignition reflects the newly inserted data.
Now, I need to delete the a row of data from the SQL table.
I’m stuck on the scripting required to pull out the UUID of this row entry. The UUID is located in a specific column in the row of data I wish to delete.
My code is below, line 10 is my issue. I’m not sure what the syntax should be. Can anyone help?
1 # Delete Entry
2
3 # Capture row index
4 row = event.source.parent.parent.getComponent('Table').selectedRow
5
6 # Define UUID column index
7 uuidCol = 11
8
9 # Capture data in the specified column
10 UUID = event.source.data.getValueAt(row, uuidCol)
11
12 # Define SQL Delete Querey
13query = "DELETE FROM table WHERE UUID = %s)" %(UUID)
14database = "TestDB"
# Run SQL query
system.db.runUpdateQuery(query,database)