# Update two or more colums of a row in a table

**URL:** <https://forum.inductiveautomation.com/t/update-two-or-more-colums-of-a-row-in-a-table/63452>\
**Category:** Ignition\
**Created:** [August 25, 2022, 1:58pm UTC](https://forum.inductiveautomation.com/t/update-two-or-more-colums-of-a-row-in-a-table/63452 "2022-08-25T13:58:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cesar\_martinez](https://avatars.discourse-cdn.com/v4/letter/c/edb3f5/32.png) [@cesar\_martinez](https://forum.inductiveautomation.com/u/cesar_martinez)\
**Post date:** [August 25, 2022, 1:58pm UTC](https://forum.inductiveautomation.com/t/update-two-or-more-colums-of-a-row-in-a-table/63452/1 "2022-08-25T13:58:18Z")

</div>

Good day,

I have a text field that will have a string and i want to pass that string to an specific table, once a button is pressed. The script will section the string in two parts and will write each part in one specific column, but so far i can only write it in one column. My script is the following:

def ames\_string(value):  
parte = value[0:2]  
ames = value[2:]  
lista\_ames = [ames,parte]  
return lista\_ames

value=event.source.parent.getComponent('Text Field').text  
tabla=event.source.parent.getComponent('Table').data

string\_parte = ames\_string(value)

# Los nombres de las columnas en lista

Columnas = system.dataset.getColumnHeaders(tabla)

col\_ames = tabla.getColumnAsList(tabla.getColumnIndex(Columnas[0]))  
col\_parte =tabla.getColumnAsList(tabla.getColumnIndex(Columnas[1]))

col\_ames.append(string\_parte[0])  
col\_parte.append(string\_parte[1])

col\_1 = system.dataset.toDataSet([Columnas[0]], [for x in col\_ames])  
col\_2 = system.dataset.toDataSet([Columnas[0]], [[y] for y in col\_ames])

event.source.parent.getComponent('Table').data = col\_1

In the last line i tried to add col\_1,col\_2 but it didnt worked.

Thank you for the support.  
Regards

CMV

---

<div class="post-metadata">

**Author:** ![Matthew.gaitan](https://avatars.discourse-cdn.com/v4/letter/m/59ef9b/32.png) [@Matthew.gaitan](https://forum.inductiveautomation.com/u/Matthew.gaitan)\
**Post date:** [August 25, 2022, 2:09pm UTC](https://forum.inductiveautomation.com/t/update-two-or-more-colums-of-a-row-in-a-table/63452/2 "2022-08-25T14:09:53Z")

</div>

Consider using [system.dataset.setValue - Ignition User Manual 8.1 - Ignition Documentation](https://docs.inductiveautomation.com/display/DOC81/system.dataset.setValue)  
or [system.dataset.addRow - Ignition User Manual 8.1 - Ignition Documentation](https://docs.inductiveautomation.com/display/DOC81/system.dataset.addRow)

Depending on if you’re updating an existing row or adding a new row

You mention updating, but it seems like you’re trying to add?

---

<div class="post-metadata">

**Author:** ![cesar\_martinez](https://avatars.discourse-cdn.com/v4/letter/c/edb3f5/32.png) [@cesar\_martinez](https://forum.inductiveautomation.com/u/cesar_martinez)\
**Post date:** [August 25, 2022, 3:23pm UTC](https://forum.inductiveautomation.com/t/update-two-or-more-colums-of-a-row-in-a-table/63452/3 "2022-08-25T15:23:19Z")

</div>

Thank you Matthew, it worked as i wanted. I appreciate the support and i wish you a great day.

Regards  
CMV

---

<div class="post-metadata">

**Author:** ![Matthew.gaitan](https://avatars.discourse-cdn.com/v4/letter/m/59ef9b/32.png) [@Matthew.gaitan](https://forum.inductiveautomation.com/u/Matthew.gaitan)\
**Post date:** [August 25, 2022, 3:26pm UTC](https://forum.inductiveautomation.com/t/update-two-or-more-colums-of-a-row-in-a-table/63452/4 "2022-08-25T15:26:12Z")

</div>

Glad you got it working!

Also, welcome to the forums 🙂
