Updating db by editing table cells

Hi, my apologies if this topic has been solved already. I found posts similar, but none that helped me get my project working. I’m new to creating dbs and have only been working with ignition for about two years. This is my first project I’m developing from scratch using it.

I’m trying to have a table that displays a db and be able to have the users edit cell values directly from the table in the project.
I’m writing the table with a transaction group:
[attachment=1]transaction group.jpg[/attachment]

Then displaying these values with a power table. I’ve made the cells editable from the table customizer, but any time I enter a new value it does not update the db.
[attachment=0]table.png[/attachment]

I have not added any scripting to this table, not sure if that is required or what else I might need to do to make this work how I want it to.

Thanks in advance for any help.

Hi dwdukelow,

A little scripting is required.

The Power Table component has an extension function called, “onCellEdited” that you need to add a Python script to.

Your script needs to update the database table with the change the user makes in the Power Table.

Here is an example of such a script:

if newValue == oldValue: return ndx = self.data.getValueAt(rowIndex,0) system.db.runPrepUpdate("UPDATE Names_and_Pins SET %s=? WHERE names_and_pins_ndx=?"% colName, [newValue,ndx]) system.db.refresh(self,"data") If your transaction group is running then it will overwrite any changes that users make when editing the table so you will need to stop the transaction group from running.

More information about the Power Table and extension functions can be found in this blog post: nickmudge.info/post/ignition-power-tables
And in the Ignition User Manual and in Inductive University.

I attached a project export that contains a window with a working editable table. You can look at that to see a working example.

Best,

Thank you for the reply on this.
I was successful in setting up the edit function for my table.