# onEditCellCommit help

**URL:** <https://forum.inductiveautomation.com/t/oneditcellcommit-help/29460>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [October 28, 2019, 7:14pm UTC](https://forum.inductiveautomation.com/t/oneditcellcommit-help/29460 "2019-10-28T19:14:47Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![mmurphy](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmurphy/32/11430_2.png) [@mmurphy](https://forum.inductiveautomation.com/u/mmurphy)\
**Post date:** [October 28, 2019, 7:14pm UTC](https://forum.inductiveautomation.com/t/oneditcellcommit-help/29460/1 "2019-10-28T19:14:47Z")

</div>

I have a table component with its data bound to a named query. I’m trying to enable the user to edit the content of certain cells. The appropriate column has props.columns[#].editable set to true but I’m struggling with the _onEditCellCommit_ event. Everything I scripted resulted in errors so I decided to use the example from the manual and build up from there. However, even the example script from the manual is giving me an error. And now I’m stumped.

**This is the script…**

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/7/78e1a30f2f250e77d31945da95a812b3a1a8eef3.png)

**This is the error (2 screenshots)…**

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/2/2f927d3bdf11326478fe9d35054996fa2535f1dd.png)

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/7/7a1daedeebe8b7d79060dd20dc5272fa7cb4e887.png)

What am I missing?

M Murphy

---

<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 28, 2019, 7:25pm UTC](https://forum.inductiveautomation.com/t/oneditcellcommit-help/29460/2 "2019-10-28T19:25:36Z")

</div>

To start, change the return format of your query binding to ‘JSON’ from ‘Dataset’ - that should clear up the error you’re getting.

---

<div class="post-metadata">

**Author:** ![mmurphy](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmurphy/32/11430_2.png) [@mmurphy](https://forum.inductiveautomation.com/u/mmurphy)\
**Post date:** [October 28, 2019, 8:37pm UTC](https://forum.inductiveautomation.com/t/oneditcellcommit-help/29460/3 "2019-10-28T20:37:06Z")

</div>

Well, that did it! I feel silly now. Thanks for your help @paul-griffith!

---

<div class="post-metadata">

**Author:** ![OscarLucas](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/oscarlucas/32/6417_2.png) [@OscarLucas](https://forum.inductiveautomation.com/u/OscarLucas)\
**Post date:** [March 1, 2021, 8:11am UTC](https://forum.inductiveautomation.com/t/oneditcellcommit-help/29460/4 "2021-03-01T08:11:01Z")

</div>

Perspective has other syntax as vision for editing cells?

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/3/936331cb31ea9d45f3d42626e4661664984883d7.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/9/e946e401e355a349228df9d757ec7338bfa76c1a.png)

---

<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:** [March 1, 2021, 1:14pm UTC](https://forum.inductiveautomation.com/t/oneditcellcommit-help/29460/5 "2021-03-01T13:14:30Z")

</div>

Substantially different. Did you look at the code above?

---

<div class="post-metadata">

**Author:** ![OscarLucas](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/oscarlucas/32/6417_2.png) [@OscarLucas](https://forum.inductiveautomation.com/u/OscarLucas)\
**Post date:** [March 3, 2021, 1:28pm UTC](https://forum.inductiveautomation.com/t/oneditcellcommit-help/29460/6 "2021-03-03T13:28:25Z")

</div>

Yes, but i get the same error.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/c/2c651ae7e820882ccee440bae7b4afc41fb38115.png)  
I thought that the solution is to use SQL language  
In that case i don’t understand what they refer to use JSON form Dataset…  
I have the table in the SQL data base…

---

<div class="post-metadata">

**Author:** ![sathianandan.dharmas](https://avatars.discourse-cdn.com/v4/letter/s/53a042/32.png) [@sathianandan.dharmas](https://forum.inductiveautomation.com/u/sathianandan.dharmas)\
**Post date:** [July 26, 2021, 3:23pm UTC](https://forum.inductiveautomation.com/t/oneditcellcommit-help/29460/7 "2021-07-26T15:23:38Z")

</div>

I’m returning a dataset from a message handler script and I can display that on a table with no problem but if I try to use the ‘OnCellEditCommit’ Action I’m getting the same error as @mmurphy. I tried converting the dataset to JSON string and a Dict using a script, and the table that I write is empty now (for both cases) since it’s expecting a dataset for props.data.

Is there a way to have a script in ‘onEditCellCommit’ in my case? I just want to know which cell was edited and the new value. TIA

Cheers  
Sam

---

<div class="post-metadata">

**Author:** ![Houssam\_Eddine\_Belfe](https://avatars.discourse-cdn.com/v4/letter/h/e95f7d/32.png) [@Houssam\_Eddine\_Belfe](https://forum.inductiveautomation.com/u/Houssam_Eddine_Belfe)\
**Post date:** [June 22, 2023, 1:56pm UTC](https://forum.inductiveautomation.com/t/oneditcellcommit-help/29460/8 "2023-06-22T13:56:10Z")

</div>

step by Step :

Cells = \> double-click "you can edit cells with double-click"  
Colums =\> Field: add the name of your row  
Configure your event =\> "write script" onEditCellCommit

got value changed : event.value  
got id : using props selected row for example  
at last : use query and do query="UPDATE NOMTABLE SET lib"+ Event.value+" WHERE ID="+STR(link to ur id)  
use :system.db.runPrepUpdate(query)

---

<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:** [June 22, 2023, 2:22pm UTC](https://forum.inductiveautomation.com/t/oneditcellcommit-help/29460/9 "2023-06-22T14:22:46Z")

</div>

> [@Houssam\_Eddine\_Belfe](#):
>
> use query and do query="UPDATE NOMTABLE SET lib"+ Event.value+" WHERE ID="+STR(link to ur id)  
> use :system.db.runPrepUpdate(query)

That's not a valid use of `runPrepQuery`. Don't inject the id into the string as a string concatenation--use the question mark substitution and supply the id in the args list. Also, you are not validating the column name for the database in any way. That's not safe to concatenate.

---

<div class="post-metadata">

**Author:** ![Houssam\_Eddine\_Belfe](https://avatars.discourse-cdn.com/v4/letter/h/e95f7d/32.png) [@Houssam\_Eddine\_Belfe](https://forum.inductiveautomation.com/u/Houssam_Eddine_Belfe)\
**Post date:** [June 22, 2023, 6:12pm UTC](https://forum.inductiveautomation.com/t/oneditcellcommit-help/29460/10 "2023-06-22T18:12:40Z")

</div>

it works but I agree with you, i should correct it 🙂  
...  
at last :  
id = STR(link to ur id)  
lib = Event.value  
args=[lib , id]  
use query and do query="UPDATE NameDATABASE.NameTABLE SET lib = ? WHERE ID= ? "  
use :system.db.runPrepUpdate(query,args)
