Some general tips when trouble shooting and asking for help on forums:
reduce the example to the minimum. Don't introduce things that have nothing to do with the problem you're trying to solve: text fields, dropdowns... etc. Especially when you're not using them (numbers and dropselect)
include the whole thing. You're using variables that are not declared in the code you posted (row and col)
deconstruct the process and check things at every step.
explain what you actually want to do. All we have to figure it out here is your code, which is not very descriptive, and if it's wrong then there's no way for us to really understand what it's supposed to do.
The title says you want to add things, but nothing in the code actually adds anything.
Then you'll need addRow.
Note that you'll probably need to supply a value for every column, which is why your attempt didn't work.
No you're not. Your newVal variable is a list with the literal strings "numbers" and "dropselect", not the values from the variables. row and col have no special meaning.
What you're looking for is system.dataset.addRow()
#get the original dataset value
ds = system.tag.readBlocking(['[default]MyData'])[0].value
#get the values from the components to insert in the dataset
#You will need to wrap them in a list.
numbers = event.source.parent.getComponent('Text Field').text
dropselect = event.source.parent.getComponent('Dropdown').selectedLabel
newRow = [numbers,dropselect]
#add row to dataset and write to the tag
system.tag.writeBlocking(['[default]MyData'],[system.dataset.addRow(ds,row=newRow)])
remove the row= bit: system.dataset.addRow(ds, newRow)]
But you'll also need a value for the timestamp column
nope it's optional. The function will append the new row to the end of the dataset if the row index is not provided.
If you want the row inserted at the top or anywhere else, then indeed you'll need to provide the index.
Yeah, I know it's optional, but "generally", if an optional parameter is skipped then you need to provide the keyword argument which is why I included it. Kind of weird that it doesn't accept keyword arguments, that seems to go against the standard.
#get the original dataset value
ds = system.tag.readBlocking(['[default]MyData'])[0].value
#get the values from the components to insert in the dataset
#You will need to wrap them in a list.
numbers = event.source.parent.getComponent('Text Field').text
dropselect = event.source.parent.getComponent('Dropdown').selectedLabel
newRow = [numbers,dropselect,system.date.now()]
#add row to dataset and write to the tag
system.tag.writeBlocking(['[default]MyData'],[system.dataset.addRow(ds,newRow)])
Traceback (most recent call last):
File "<event:actionPerformed>", line 13, in <module>
ValueError: Cannot coerce value '<java function now 0x2>' into type: class java.util.Date