Dataset type tag manipulation with system.dataset functions

Need some help on manipulating dataset type tags. The idea is to have dataset tags which will hold the list of currently logged in users. Columns will be fixed (User ID, UserName, AccessLevel) and rows will be added/removed as users log-in/log-out and cleared at the end of the shift. Dataset will be displayed in table. So I have created UDT data type with column names (the idea is that in script only data section would need to manipulated and headers are set in UDT).
But I am having some trouble trying to add a row (currently testing in script console).
Examples in help are for manipulating dataset extracted from component.

# This script should be on a button that is a sibling to a Dropdown List component named "Dropdown".
dropdown = event.source.parent.getComponent("Dropdown")
newRow = [5, "New Option"] = system.dataset.addRow(, newRow)

How do I use this on dataset type tag ?

new_row = [12345,"fName lName", 3]
users = system.tag.readBlocking("[default]IDBadgeManager/CurrentUsers/DH04_CurrentUsers/Users")
print(users) = system.dataset.addRow(, newRow)

First readBlocking doesn't directly return the value itself, nor does .data apply.
Second, you must write the new dataset back to the tag, typically with writeBlocking.
Something like this:

new_row = [12345,"fName lName", 3]
usersTagPath = "[default]IDBadgeManager/CurrentUsers/DH04_CurrentUsers/Users"
user_ds = system.tag.readBlocking(usersTagPath)[0].value
print user_ds
new_ds = system.dataset.addRow(, newRow)
returned_qualities = system.tag.writeBlocking([usersTagPath], [new_ds])
print returned_qualities
1 Like