Hi to everybody
I created a datataset tag, and I read the its value correctly using the follow syntax
system.tag.read(“tagdata”).value.getValueAt(1, 0)
But now I need write a value to into a specific row and column, what is the correct syntax?
Thanks a lot
Andrea
I think you will find the following link helpful: https://docs.inductiveautomation.com:8443/display/DOC79/Working+with+Datasets
For your question. You can use the function: system.dataset.setValue which is referenced in the link above.
One clarification: system.dataset.setValue() returns a new dataset that you must write back to the tag. Like so:
ds = system.tag.read("tagdata").value
system.tag.write("tagdata", system.dataset.setValue(ds, row, col, newVal))
3 Likes
Hi
Thank you very much Phil, I have tried with only system,dataset,setValue and not worked.
Great!!
Best
One warning here wrt threading: Getting a dataset, updating it, and writing it back again does cost some time and is certainly not atomic.
If you expect frequent updates from different users, it’s quite likely that a change to one row from one user will be overwritten by a change of another row from another user (as you’re updating the entire dataset every time).
It’s fine for values that update seldomly, or by maximum one user at a time. But for frequent updated data, working with datasets like this should be avoided and you’ll either need to resort to separate tags (which can be updated one at a time), or databases (where updates are atomic).
3 Likes
Hi Sander
Thank you fo the your interesting suggestion 
Andrea
These links dont work anymore
https://docs.inductiveautomation.com/display/DOC79/Datasets#Datasets-AlteringaDataset
This should be the equivalent page in the manual. Not completely certain if it has all the same information, but it does cover setValue.