# Script adding rows to dataset works perfect in 7.9 fails in 8!

**URL:** <https://forum.inductiveautomation.com/t/script-adding-rows-to-dataset-works-perfect-in-7-9-fails-in-8/31496>\
**Category:** Ignition\
**Created:** [January 21, 2020, 11:22pm UTC](https://forum.inductiveautomation.com/t/script-adding-rows-to-dataset-works-perfect-in-7-9-fails-in-8/31496 "2020-01-21T23:22:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![erfritts](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/erfritts/32/3660_2.png) [@erfritts](https://forum.inductiveautomation.com/u/erfritts)\
**Post date:** [January 21, 2020, 11:22pm UTC](https://forum.inductiveautomation.com/t/script-adding-rows-to-dataset-works-perfect-in-7-9-fails-in-8/31496/1 "2020-01-21T23:22:40Z")

</div>

I have been using this little tactic in my scripts for some time and now with Ignition 8 it is failing to always add all the rows. Is there something that I should be doing different now?

```
 for item in items:
     rowlist = system.tag.read("[client]unloaditems").value
     newrow = [item['uid'], item['itemnum'], item['itemdescription'], item['qty'], item['units'], item['confirmedunload']]
     newlist = system.dataset.addRow(rowlist, newrow)
     system.tag.write("[client]unloaditems", newlist)
```

---

<div class="post-metadata">

**Author:** ![jpark](https://avatars.discourse-cdn.com/v4/letter/j/a88e57/32.png) [@jpark](https://forum.inductiveautomation.com/u/jpark)\
**Post date:** [January 22, 2020, 4:13am UTC](https://forum.inductiveautomation.com/t/script-adding-rows-to-dataset-works-perfect-in-7-9-fails-in-8/31496/2 "2020-01-22T04:13:10Z")

</div>

You are reading the value of the client tag inside the loop and then writing back to it.  
system.tag.write is asynchronous, so it does not wait for the write to occur before returning.  
You should do something like the following:

```auto
unloadItemsDS = system.tag.getTagValue("[client]unloaditems")
rowsToAppend = []
for item in items:
	rowsToAppend.append([item['uid'], item['itemnum'], item['itemdescription'], item['qty'], item['units'], item['confirmedunload']])
unloadItemDS = system.dataset.addRows(unloadItemsDS,rowsToAppend)
system.tag.write("[client]unloaditems",unloadItemDS)

```

---

<div class="post-metadata">

**Author:** ![erfritts](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/erfritts/32/3660_2.png) [@erfritts](https://forum.inductiveautomation.com/u/erfritts)\
**Post date:** [January 22, 2020, 2:03pm UTC](https://forum.inductiveautomation.com/t/script-adding-rows-to-dataset-works-perfect-in-7-9-fails-in-8/31496/3 "2020-01-22T14:03:06Z")

</div>

Thanks so much. I thought that you actually had to call Asynch. Works perfect now.
