# Scripting a property change in a table

**URL:** <https://forum.inductiveautomation.com/t/scripting-a-property-change-in-a-table/8453>\
**Category:** Ignition\
**Created:** [May 15, 2014, 3:37pm UTC](https://forum.inductiveautomation.com/t/scripting-a-property-change-in-a-table/8453 "2014-05-15T15:37:29Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![AMurray](https://avatars.discourse-cdn.com/v4/letter/a/dfb087/32.png) [@AMurray](https://forum.inductiveautomation.com/u/AMurray)\
**Post date:** [May 15, 2014, 3:37pm UTC](https://forum.inductiveautomation.com/t/scripting-a-property-change-in-a-table/8453/1 "2014-05-15T15:37:29Z")

</div>

I have a table that I would like to be able to edit cells and have those new values written to the tags that are bound to said cell. As I understand tables in Ignition are not bi-directional so I need a property change script to pass the edited values. This seems like a it would be a common issue so does anyone out there have a script for editing tables and having those values recorded in the PLC?

---

<div class="post-metadata">

**Author:** ![adamaustin](https://avatars.discourse-cdn.com/v4/letter/a/5f8ce5/32.png) [@adamaustin](https://forum.inductiveautomation.com/u/adamaustin)\
**Post date:** [May 15, 2014, 5:08pm UTC](https://forum.inductiveautomation.com/t/scripting-a-property-change-in-a-table/8453/2 "2014-05-15T17:08:58Z")

</div>

You’ll have to write to the SQLTag (and, thus, the PLC) through the [cellEdited](http://inductiveautomation.com/support/usermanuals/ignition/event_types.htm#cell) event.

---

<div class="post-metadata">

**Author:** ![AMurray](https://avatars.discourse-cdn.com/v4/letter/a/dfb087/32.png) [@AMurray](https://forum.inductiveautomation.com/u/AMurray)\
**Post date:** [May 15, 2014, 6:34pm UTC](https://forum.inductiveautomation.com/t/scripting-a-property-change-in-a-table/8453/3 "2014-05-15T18:34:15Z")

</div>

Yes I understand where the script goes but what I want to know is how to write it so it determines which cell was edited and writes the new value to the appropriate tag.

---

<div class="post-metadata">

**Author:** ![Paullys50](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paullys50/32/3324_2.png) [@Paullys50](https://forum.inductiveautomation.com/u/Paullys50)\
**Post date:** [May 15, 2014, 8:34pm UTC](https://forum.inductiveautomation.com/t/scripting-a-property-change-in-a-table/8453/4 "2014-05-15T20:34:16Z")

</div>

It is a common issue, and they cover it in the “help” files.

“Tutorials and helpful tricks” section —\> “Creating and editable table in Ignition”

I followed this to do what you’re asking. Was pretty easy.

---

<div class="post-metadata">

**Author:** ![greg.simpson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/greg.simpson/32/3135_2.png) [@greg.simpson](https://forum.inductiveautomation.com/u/greg.simpson)\
**Post date:** [May 16, 2014, 6:12pm UTC](https://forum.inductiveautomation.com/t/scripting-a-property-change-in-a-table/8453/5 "2014-05-16T18:12:05Z")

</div>

An editable table is probably what you are after, you can read up on it here

[inductiveautomation.com/supp … igniti.htm](http://www.inductiveautomation.com/support/usermanuals/ignition/creating_an_editable_in_igniti.htm)

There is an example at the bottom of the page you can use as well.

---

<div class="post-metadata">

**Author:** ![AMurray](https://avatars.discourse-cdn.com/v4/letter/a/dfb087/32.png) [@AMurray](https://forum.inductiveautomation.com/u/AMurray)\
**Post date:** [May 19, 2014, 12:43pm UTC](https://forum.inductiveautomation.com/t/scripting-a-property-change-in-a-table/8453/6 "2014-05-19T12:43:52Z")

</div>

This worked but I am still having trouble writing to the tag that was bound to the cell I have edited. How can I get my script to identify the tag bound to the edited cell and then write the newValue to that cell specific tag? I am currently using cell update binding to write tag values to the table.

This is the code that I have used to successfully write to one tag no matter which cell was edited.

[code]row = event.row  
col = event.column  
colName = event.source.data.getColumnName(col)  
value = event.newValue  
id = event.source.data.getValueAt(row, 0)

system.tag.write(“MainProgram/Hand\_1\_Set”, value)[/code]

---

<div class="post-metadata">

**Author:** ![greg.simpson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/greg.simpson/32/3135_2.png) [@greg.simpson](https://forum.inductiveautomation.com/u/greg.simpson)\
**Post date:** [July 11, 2014, 6:58pm UTC](https://forum.inductiveautomation.com/t/scripting-a-property-change-in-a-table/8453/7 "2014-07-11T18:58:25Z")

</div>

Sorry for the delay in reply. I was able to get this working with this script in a cellEdited script on the table component. This is the script I used

`row = event.row
tag = event.source.data.getValueAt(row, 0)
system.tag.write(tag, event.newValue)
`

Pretty basic. Column 0 of the table I made hidden and is where I stored my tagpath. I did use a cell update binding for the column I used for the tag value.

 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/9/93bee6425f8aef7fbc8e94cdb628d376da5b5db8.PNG)  
  
 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/4/439c7169154d191c8b424dd266f0262b84bee88f.PNG)
