Help with Tables and Datasets

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?

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.

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

1 Like

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

2 Likes

thank you, been a long night lol

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

Edit: Victor beat me to it.

2 Likes

Worked. Thanks guys.

1 Like

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:

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. }

2 Likes