Datasets in Memory Tags

Hello,

I’m designing a new view on Perspective so that every time we want to update or add a new program for our CNC machines we can write to a memory tag with a dataset the information needed for the updated or new programs. The idea is to fill a couple of field texts and then click a button to “Save” the new values into the dataset in my memory tag. I’m a little lost on how to do it , any help or suggestion would be much appreciated.

# untested, but this should theoretically work
tagPath = "<provider>Your/Tag/Path"
original_dataset = system.tag.readBlocking([tagPath])[0].value
new_dataset = system.dataset.addRow(original_dataset, ["col1value", "col2value"])
system.tag.writeBlocking([tagPath],[new_dataset])

See the docs.

Thank you very much for the quick response! I needed to do a minor change to the scrip to get it working because the addRow() instruction doesn’t take keyword arguments, this is how the script should be:

tagPath = “Your/Tag/Path”
original_dataset = system.tag.readBlocking([tagPath])[0].value
new_dataset = system.dataset.addRow(original_dataset, [“Value1”, “Value2”])
system.tag.writeBlocking([tagPath],[new_dataset])