# Help with Tables and Datasets

**URL:** <https://forum.inductiveautomation.com/t/help-with-tables-and-datasets/58214>\
**Category:** Ignition\
**Tags:** ignition80, vision, scripting\
**Created:** [April 8, 2022, 11:51am UTC](https://forum.inductiveautomation.com/t/help-with-tables-and-datasets/58214 "2022-04-08T11:51:53Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tyler\_Muckley](https://avatars.discourse-cdn.com/v4/letter/t/b4bc9f/32.png) [@Tyler\_Muckley](https://forum.inductiveautomation.com/u/Tyler_Muckley)\
**Post date:** [April 8, 2022, 11:51am UTC](https://forum.inductiveautomation.com/t/help-with-tables-and-datasets/58214/1 "2022-04-08T11:51:53Z")

</div>

Hey everyone,

Trying to get a simple dashboard set up for us to be able to scan in bar codes and run queries based on those barcodes scanned. I want to store all my scanned items into a table then use a power table to display the queries based on every barcode scanned in. Currently I am having troubles with getting the first table to update based on a text field. Code is functioning but not updating the table. Any help?

```auto
table = event.source.parent.getComponent('inputTable').data
inputData = event.source.text

dataList = []
updatedTable = ''
#tableData.append(inputData)

if event.keyCode == event.VK_ENTER:
	#system.gui.messageBox("Test")
	if inputData != '':
		dataList.append(inputData)
		updatedTable = system.dataset.addRow(table, dataList)
		table = updatedTable
		print dataList

```

The print is just a way to know that when I press enter that something is happening.

Thanks friends.

---

<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:** [April 8, 2022, 11:55am UTC](https://forum.inductiveautomation.com/t/help-with-tables-and-datasets/58214/2 "2022-04-08T11:55:32Z")

</div>

Pssst! Replace your triple quotes with triple back-quotes. These: ```

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [April 8, 2022, 11:56am UTC](https://forum.inductiveautomation.com/t/help-with-tables-and-datasets/58214/3 "2022-04-08T11:56:15Z")

</div>

> [@Tyler\_Muckley](#):
>
> table = updatedTable

this is probably not enough  
try this  
`event.source.parent.getComponent('inputTable').data = updatedTable`

---

<div class="post-metadata">

**Author:** ![Tyler\_Muckley](https://avatars.discourse-cdn.com/v4/letter/t/b4bc9f/32.png) [@Tyler\_Muckley](https://forum.inductiveautomation.com/u/Tyler_Muckley)\
**Post date:** [April 8, 2022, 11:56am UTC](https://forum.inductiveautomation.com/t/help-with-tables-and-datasets/58214/4 "2022-04-08T11:56:25Z")

</div>

thank you, been a long night lol

---

<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:** [April 8, 2022, 11:56am UTC](https://forum.inductiveautomation.com/t/help-with-tables-and-datasets/58214/5 "2022-04-08T11:56:25Z")

</div>

You need to assign to the `.data` property of the component.

Edit: Victor beat me to it.

---

<div class="post-metadata">

**Author:** ![Tyler\_Muckley](https://avatars.discourse-cdn.com/v4/letter/t/b4bc9f/32.png) [@Tyler\_Muckley](https://forum.inductiveautomation.com/u/Tyler_Muckley)\
**Post date:** [April 8, 2022, 11:57am UTC](https://forum.inductiveautomation.com/t/help-with-tables-and-datasets/58214/6 "2022-04-08T11:57:44Z")

</div>

> [@victordcq](#):
>
> event.source.parent.getComponent('inputTable').data

Worked. Thanks guys.

---

<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:** [April 8, 2022, 12:01pm UTC](https://forum.inductiveautomation.com/t/help-with-tables-and-datasets/58214/7 "2022-04-08T12:01:03Z")

</div>

I generally assign the component itself to a local variable (of the same name) in such scripts. Then all properties are available “naturally”. Something like this:

```auto
inputTable = event.source.parent.getComponent('inputTable')

newDS = system.dataset.addRow(inputTable.data, [some stuff])

inputTable.data = newDS

```

I tend to use proper caps in component names so the corresponding named script objects stand out.

{ If I use the property picker at all, I clean up the resulting code. }
