# Powertable set data property from CellEdited

**URL:** <https://forum.inductiveautomation.com/t/powertable-set-data-property-from-celledited/68322>\
**Category:** Ignition\
**Tags:** vision, scripting, ignition81\
**Created:** [January 6, 2023, 7:25pm UTC](https://forum.inductiveautomation.com/t/powertable-set-data-property-from-celledited/68322 "2023-01-06T19:25:57Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![juang](https://avatars.discourse-cdn.com/v4/letter/j/9dc877/32.png) [@juang](https://forum.inductiveautomation.com/u/juang)\
**Post date:** [January 6, 2023, 7:25pm UTC](https://forum.inductiveautomation.com/t/powertable-set-data-property-from-celledited/68322/1 "2023-01-06T19:25:57Z")

</div>

I'm trying to run this on a CellEdited but it does not set the value of self.data to the query below. the query is correct i test it outside. but self.data does not change, can anyone tell me why?

```
def onCellEdited(self, rowIndex, colIndex, colName, oldValue, newValue):
		
	orderid = self.parent.OrderID
	invoiceid = self.parent.ID
	ordertype = self.parent.ordertype
	locationfrom = self.parent.locationfrom

	if colName == 'id' and newValue != oldValue:
		if newValue == 0:
			print "entro a borrar"   
	     	system.db.runNamedQuery("Orders/DeleteInvoiceTempPallet", {"PALLET_ID": old Value, "ORDER_ID": invoiceid, "ORDER_TYPE": ordertype})
		    self.data = system.db.runNamedQuery("Orders/SelectCustomInvoiceTempPallet", {"ORDER_ID": invoiceid, "LOCATION_FROM": locationfrom})

```

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [January 6, 2023, 7:42pm UTC](https://forum.inductiveautomation.com/t/powertable-set-data-property-from-celledited/68322/2 "2023-01-06T19:42:52Z")

</div>

Your indentation is wrong. Everything under `def` should be indented one tab stop.

---

<div class="post-metadata">

**Author:** ![juang](https://avatars.discourse-cdn.com/v4/letter/j/9dc877/32.png) [@juang](https://forum.inductiveautomation.com/u/juang)\
**Post date:** [January 6, 2023, 7:47pm UTC](https://forum.inductiveautomation.com/t/powertable-set-data-property-from-celledited/68322/3 "2023-01-06T19:47:32Z")

</div>

Thanks for pointing that out, it but it was when I pasted the code here that I made the mistake, in Igntion my code it was correct , now I have corrected here also. the print runs, and the first name query also runs, but i can't set the data property with the self.data

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [January 6, 2023, 9:40pm UTC](https://forum.inductiveautomation.com/t/powertable-set-data-property-from-celledited/68322/4 "2023-01-06T21:40:38Z")

</div>

How is the data initially set? Do you have a data binding? If so, consider replacing the last line of your script with ` system.db.refresh(self, data)`

---

<div class="post-metadata">

**Author:** ![juang](https://avatars.discourse-cdn.com/v4/letter/j/9dc877/32.png) [@juang](https://forum.inductiveautomation.com/u/juang)\
**Post date:** [January 6, 2023, 9:54pm UTC](https://forum.inductiveautomation.com/t/powertable-set-data-property-from-celledited/68322/5 "2023-01-06T21:54:09Z")

</div>

no binding, i want to set data from that script

---

<div class="post-metadata">

**Author:** ![sharan](https://avatars.discourse-cdn.com/v4/letter/s/258eb7/32.png) [@sharan](https://forum.inductiveautomation.com/u/sharan)\
**Post date:** [July 12, 2025, 9:11am UTC](https://forum.inductiveautomation.com/t/powertable-set-data-property-from-celledited/68322/6 "2025-07-12T09:11:43Z")

</div>

I have a powertable in vision with no binding,  
I need to edit the X column and want to save the edited column even after client is relaunched,  
now its keeping the values until i close the vision client, after i relaunch its showing me old values ( from designer probably).

I have the following script on cell edited -

```python
def onCellEdited(self, rowIndex, colIndex, colName, oldValue, newValue):
	self.data = system.dataset.setValue(self.data, rowIndex, colIndex, newValue)

```

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [July 12, 2025, 12:22pm UTC](https://forum.inductiveautomation.com/t/powertable-set-data-property-from-celledited/68322/7 "2025-07-12T12:22:07Z")

</div>

> [@sharan](#):
>
> even after client is relaunched,

Then you need to save the content somewhere. Typically, that would be a database, and you would typically use a binding to load that content back in on startup.

There's no magic wand.
