# Using system.data.setValue to prefill more than 1 column

**URL:** <https://forum.inductiveautomation.com/t/using-system-data-setvalue-to-prefill-more-than-1-column/8759>\
**Category:** Ignition\
**Created:** [July 19, 2014, 5:45pm UTC](https://forum.inductiveautomation.com/t/using-system-data-setvalue-to-prefill-more-than-1-column/8759 "2014-07-19T17:45:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cacordova](https://avatars.discourse-cdn.com/v4/letter/c/bbce88/32.png) [@cacordova](https://forum.inductiveautomation.com/u/cacordova)\
**Post date:** [July 19, 2014, 5:45pm UTC](https://forum.inductiveautomation.com/t/using-system-data-setvalue-to-prefill-more-than-1-column/8759/1 "2014-07-19T17:45:37Z")

</div>

I’m trying to pre-fill values on 2 columns,

I’m testing it on the sample code I saw on the manual

`table = event.source.parent.getComponent("Table")
selRow = table.getSelectedRow()
selCol = table.getSelectedColumn()
if selRow != -1 and selCol != -1:
   newData = system.dataset.setValue(table.data, selRow, 'C', 'Test1')
   table.data = newData`

I also want to prefill another value on column ‘D’ with the value ‘Test2’ on the same row. What’s the correct syntax for that?

Thank You

---

<div class="post-metadata">

**Author:** ![nmudge](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nmudge/32/3394_2.png) [@nmudge](https://forum.inductiveautomation.com/u/nmudge)\
**Post date:** [July 19, 2014, 6:52pm UTC](https://forum.inductiveautomation.com/t/using-system-data-setvalue-to-prefill-more-than-1-column/8759/2 "2014-07-19T18:52:27Z")

</div>

Like this:

```auto
table = event.source.parent.getComponent("Table")
selRow = table.getSelectedRow()
selCol = table.getSelectedColumn()
if selRow != -1 and selCol != -1:
   newData = system.dataset.setValue(table.data, selRow, 'C', 'Test1')
   newData = system.dataset.setValue(newData, selRow, 'D', 'Test2')
   table.data = newData
```

---

<div class="post-metadata">

**Author:** ![cacordova](https://avatars.discourse-cdn.com/v4/letter/c/bbce88/32.png) [@cacordova](https://forum.inductiveautomation.com/u/cacordova)\
**Post date:** [July 19, 2014, 6:53pm UTC](https://forum.inductiveautomation.com/t/using-system-data-setvalue-to-prefill-more-than-1-column/8759/3 "2014-07-19T18:53:48Z")

</div>

Great. Thanks!
