# PowerTable onCellEdited script isnt updating the sql database

**URL:** <https://forum.inductiveautomation.com/t/powertable-oncelledited-script-isnt-updating-the-sql-database/115053>\
**Category:** Ignition\
**Created:** [April 13, 2026, 8:26pm UTC](https://forum.inductiveautomation.com/t/powertable-oncelledited-script-isnt-updating-the-sql-database/115053 "2026-04-13T20:26:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dpace](https://avatars.discourse-cdn.com/v4/letter/d/8c91f0/32.png) [@dpace](https://forum.inductiveautomation.com/u/dpace)\
**Post date:** [April 13, 2026, 8:26pm UTC](https://forum.inductiveautomation.com/t/powertable-oncelledited-script-isnt-updating-the-sql-database/115053/1 "2026-04-13T20:26:01Z")

</div>

```python
# Example
    #self.data = system.dataset.setValue(self.data, rowIndex, colIndex, newValue)
    ndx = self.data.getValueAt(rowIndex, 'Formula')
    
    query = "UPDATE BL1Formulas SET %s = ? WHERE Formula = ?" % (colName)
    
    system.db.runPrepUpdate(BL1Formulas, [value,ndx],'Kens_OT')
    
    system.db.refresh(self.data)

```

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [April 13, 2026, 8:33pm UTC](https://forum.inductiveautomation.com/t/powertable-oncelledited-script-isnt-updating-the-sql-database/115053/2 "2026-04-13T20:33:45Z")

</div>

First step is to debug the query itself and check the gateway for error messages. Print the query, the args, and their types.

```python
# use system.perspective.print() instead of print() if using perspective.
print query
print 'value:{}, type:{}'.format(value,type(value))
print 'ndx:{}, type:{}'.format(ndx,type(ndx))

```

---

<div class="post-metadata">

**Author:** ![MMaynard](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmaynard/32/3366_2.png) [@MMaynard](https://forum.inductiveautomation.com/u/MMaynard)\
**Post date:** [April 13, 2026, 8:54pm UTC](https://forum.inductiveautomation.com/t/powertable-oncelledited-script-isnt-updating-the-sql-database/115053/3 "2026-04-13T20:54:58Z")

</div>

> [@dpace](#):
>
> `system.db.runPrepUpdate(BL1Formulas, [value,ndx],'Kens_OT')`

That should probably be

> [@dpace](#):
>
> `system.db.runPrepUpdate(BL1Formulas, [newValue,ndx],'Kens_OT')`

Value isn’t a valid pointer in onCellEdited
