# Power Table triggering twice onCellEdited in 7.9.21?

**URL:** <https://forum.inductiveautomation.com/t/power-table-triggering-twice-oncelledited-in-7-9-21/80298>\
**Category:** Ignition\
**Tags:** ignition79, vision\
**Created:** [October 10, 2023, 7:04pm UTC](https://forum.inductiveautomation.com/t/power-table-triggering-twice-oncelledited-in-7-9-21/80298 "2023-10-10T19:04:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [October 10, 2023, 7:04pm UTC](https://forum.inductiveautomation.com/t/power-table-triggering-twice-oncelledited-in-7-9-21/80298/1 "2023-10-10T19:04:06Z")

</div>

Been a long day I don't know if I am missing something simple. I am using Ignition 7.9.21 Vision with a power table onCellEdited extension function. My task is simple, let a user modify a column and update it in the database table.

My script on the onCellEdited extension is pretty simple imo -

```auto
print 'triggered %s %s'%(str(oldValue), str(newValue))
if system.gui.confirm("Are you sure you want to update CSV column name from %s to %s?"%(str(oldValue), str(newValue))):
	idx = self.data.getValueAt(rowIndex, 'idx')
	print 'idx %i type %s'%(idx, str(type(idx)))
	params = {'csvColumn':str(newValue), 'idx':idx}
	print 'params %s'%(str(params))
	system.db.runNamedQuery('CSV/update', params)
	print 'ran q'
	system.db.refresh(self, 'data')
	print 'refreshing'

```

When I click on the cell, edit the text, the onCellEdited gets triggered twice (but only if I have my full script).

When I have my full script the print statements read

```auto
triggered blah blah2
triggered blah blah2
idx 1 type <type 'int'>
params {'idx': 1, 'csvColumn': 'blah2'}
ran q
refreshing
idx 1 type <type 'int'>
params {'idx': 1, 'csvColumn': 'blah2'}
ran q
refreshing

```

And I get the system.gui.confrimation appears twice. If I remove my syste.gui.confirm and only have the top print statement, I get what I would expect when I edit the text and hit enter - only one print statement of the change like so -

```auto
triggered blah blah3

```

Just the one change.

Why is it double firing when I have the rest of my script there? I see both print statements

```auto
triggered blah blah2
triggered blah blah2

```

before I see the first `system.gui.confirm`. I tried changing the `Edit Click Count` from 1 to 2. I know I could add a custom property to act as a lock and only run my script if it's available but I feel like I am just missing something simple here. What am I missing here?

Edit: Forgot to mention it's a power table.

---

<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:** [October 10, 2023, 7:27pm UTC](https://forum.inductiveautomation.com/t/power-table-triggering-twice-oncelledited-in-7-9-21/80298/2 "2023-10-10T19:27:32Z")

</div>

We ran into that a loooong time ago and added an invokeLater call

```auto

	def runUpdate():
		import system
		if system.gui.confirm('Are you sure?', 'Do It',1):
			ID = self.data.getValueAt(rowIndex,"ID")
			query = "UPDATE SYS_Info SET " + colName + " = ? WHERE ID = ?"
			values = [newValue, ID]
			system.db.runPrepUpdate(query, values,database='MyDB')
			system.db.refresh(self,"data")
	if colName=='PA' and oldValue <> newValue:
		system.util.invokeLater(runUpdate)
	else:
		pass

```

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [October 10, 2023, 7:27pm UTC](https://forum.inductiveautomation.com/t/power-table-triggering-twice-oncelledited-in-7-9-21/80298/3 "2023-10-10T19:27:44Z")

</div>

> [@bkarabinchak.psi](#):
>
> `system.gui.confirm`

It's an interaction with this. I think if you put it all in an invokeLater it'll work?

---

<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:** [October 10, 2023, 7:36pm UTC](https://forum.inductiveautomation.com/t/power-table-triggering-twice-oncelledited-in-7-9-21/80298/4 "2023-10-10T19:36:12Z")

</div>

Or get rid of it by having a separate "edit mode" toggle in the UI. (I despise `system.gui.confirm()` and its modal peers. Just say **no**.)

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [October 11, 2023, 11:47am UTC](https://forum.inductiveautomation.com/t/power-table-triggering-twice-oncelledited-in-7-9-21/80298/5 "2023-10-11T11:47:46Z")

</div>

Yea normally I do a table just for a list/detail type pattern where the table only lists entries and there is a popup to edit any entry, which is how it's done in the rest of the project. This was a last minute ask, for a admin configuration table that _MIGHT_ need to be changed once a year, for only a single column of a 2 column table. So I was ok with doing it this way for this particular case. I agree with you in general and that is normally what I do.
