# System.db.refresh not working in template instance?

**URL:** <https://forum.inductiveautomation.com/t/system-db-refresh-not-working-in-template-instance/11938>\
**Category:** Ignition\
**Created:** [July 16, 2016, 8:46pm UTC](https://forum.inductiveautomation.com/t/system-db-refresh-not-working-in-template-instance/11938 "2016-07-16T20:46:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bfaivre](https://avatars.discourse-cdn.com/v4/letter/b/f19dbf/32.png) [@bfaivre](https://forum.inductiveautomation.com/u/bfaivre)\
**Post date:** [July 16, 2016, 8:46pm UTC](https://forum.inductiveautomation.com/t/system-db-refresh-not-working-in-template-instance/11938/1 "2016-07-16T20:46:14Z")

</div>

Hello,

I have a Power Table where I use the onCellEdited Extension Function to add editing capability to the table. The Extension Function looks like this:

[code]id = self.data.getValueAt(rowIndex, self.updateTableIdName)

query = “UPDATE [%s] SET [%s] = ? WHERE [%s] = ?” % (self.updateTableName, colName, self.updateTableIdName)

args = [newValue, id]

system.db.runPrepUpdate(query, args)

system.db.refresh(self, “data”)  
[/code]

updateTableIdName and updateTableName are custom properties on the power table.

I’ve then created a template using this Power Table. The template has 3 template parameters:

1. Data {DataSet}
2. updateTableIdName {String}
3. updateTableName {String}

I then bind the Power Table’s (in the template) Data, updateTableIdName updateTableName to the template parameters I just mentioned.

Edits get written to the database in both the non templated and templated Power Tables. However, only the non templated Power Table is refreshed.

Thanks in advance,

Brian

---

<div class="post-metadata">

**Author:** ![bfaivre](https://avatars.discourse-cdn.com/v4/letter/b/f19dbf/32.png) [@bfaivre](https://forum.inductiveautomation.com/u/bfaivre)\
**Post date:** [July 19, 2016, 11:53pm UTC](https://forum.inductiveautomation.com/t/system-db-refresh-not-working-in-template-instance/11938/2 "2016-07-19T23:53:02Z")

</div>

Got some help from Paolo at tech support.

Changing “system.db.refresh(self, “data”)” to “system.db.refresh(self.parent.parent, “data”)” did the trick.
