# Write a value to a dataset tag

**URL:** <https://forum.inductiveautomation.com/t/write-a-value-to-a-dataset-tag/15532>\
**Category:** Ignition\
**Created:** [October 2, 2017, 12:37pm UTC](https://forum.inductiveautomation.com/t/write-a-value-to-a-dataset-tag/15532 "2017-10-02T12:37:09Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![andrea.minu](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/andrea.minu/32/3326_2.png) [@andrea.minu](https://forum.inductiveautomation.com/u/andrea.minu)\
**Post date:** [October 2, 2017, 12:37pm UTC](https://forum.inductiveautomation.com/t/write-a-value-to-a-dataset-tag/15532/1 "2017-10-02T12:37:09Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![brandon1](https://avatars.discourse-cdn.com/v4/letter/b/ea666f/32.png) [@brandon1](https://forum.inductiveautomation.com/u/brandon1)\
**Post date:** [October 2, 2017, 1:01pm UTC](https://forum.inductiveautomation.com/t/write-a-value-to-a-dataset-tag/15532/2 "2017-10-02T13:01:50Z")

</div>

I think you will find the following link helpful: [https://docs.inductiveautomation.com:8443/display/DOC79/Working+with+Datasets](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.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [October 2, 2017, 1:22pm UTC](https://forum.inductiveautomation.com/t/write-a-value-to-a-dataset-tag/15532/3 "2017-10-02T13:22:33Z")

</div>

One clarification: system.dataset.setValue() returns a **_new_** dataset that you must write back to the tag. Like so:

```auto
ds = system.tag.read("tagdata").value
system.tag.write("tagdata", system.dataset.setValue(ds, row, col, newVal))

```

---

<div class="post-metadata">

**Author:** ![andrea.minu](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/andrea.minu/32/3326_2.png) [@andrea.minu](https://forum.inductiveautomation.com/u/andrea.minu)\
**Post date:** [October 2, 2017, 1:41pm UTC](https://forum.inductiveautomation.com/t/write-a-value-to-a-dataset-tag/15532/4 "2017-10-02T13:41:49Z")

</div>

Hi

Thank you very much Phil, I have tried with only system,dataset,setValue and not worked.

Great!!

Best

---

<div class="post-metadata">

**Author:** ![Sanderd17](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sanderd17/32/8735_2.png) [@Sanderd17](https://forum.inductiveautomation.com/u/Sanderd17)\
**Post date:** [October 2, 2017, 2:02pm UTC](https://forum.inductiveautomation.com/t/write-a-value-to-a-dataset-tag/15532/5 "2017-10-02T14:02:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![andrea.minu](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/andrea.minu/32/3326_2.png) [@andrea.minu](https://forum.inductiveautomation.com/u/andrea.minu)\
**Post date:** [October 2, 2017, 8:19pm UTC](https://forum.inductiveautomation.com/t/write-a-value-to-a-dataset-tag/15532/6 "2017-10-02T20:19:34Z")

</div>

Hi Sander  
Thank you fo the your interesting suggestion 👍  
Andrea

---

<div class="post-metadata">

**Author:** ![saadia.gauhar](https://avatars.discourse-cdn.com/v4/letter/s/9fc29f/32.png) [@saadia.gauhar](https://forum.inductiveautomation.com/u/saadia.gauhar)\
**Post date:** [September 27, 2019, 4:02pm UTC](https://forum.inductiveautomation.com/t/write-a-value-to-a-dataset-tag/15532/7 "2019-09-27T16:02:23Z")

</div>

These links dont work anymore

---

<div class="post-metadata">

**Author:** ![grietveld](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/grietveld/32/6984_2.png) [@grietveld](https://forum.inductiveautomation.com/u/grietveld)\
**Post date:** [September 27, 2019, 4:52pm UTC](https://forum.inductiveautomation.com/t/write-a-value-to-a-dataset-tag/15532/8 "2019-09-27T16:52:47Z")

</div>

[https://docs.inductiveautomation.com/display/DOC79/Datasets#Datasets-AlteringaDataset](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.
