# Getting a row from a dataset

**URL:** <https://forum.inductiveautomation.com/t/getting-a-row-from-a-dataset/7833>\
**Category:** General Discussion\
**Created:** [January 14, 2014, 4:22pm UTC](https://forum.inductiveautomation.com/t/getting-a-row-from-a-dataset/7833 "2014-01-14T16:22:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![JGJohnson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jgjohnson/32/29582_2.png) [@JGJohnson](https://forum.inductiveautomation.com/u/JGJohnson)\
**Post date:** [January 14, 2014, 4:22pm UTC](https://forum.inductiveautomation.com/t/getting-a-row-from-a-dataset/7833/1 "2014-01-14T16:22:02Z")

</div>

I have a dataset with 1 row that I would like to add to another dataset for exporting.

I know I can easily loop though the columns, append them to a list and add that as the new row but is there built in way to just get the entire row?

For example; if I remember correctly, in .NET I could use something like DataSet.Tables[0].Rows[0] to get the entire row. I haven’t found anything similar in the Ignition documentation.

Something like this:

```auto
# This code is not valid
datset1 = system.dataset.addRow(dataset1, dataset1.rowCount, dataset2.rows[0])
```

would be much nicer than this:

```auto
newRow = []
for col in range(dataset2.columnCount):
    newRow.append(dataset2.getValueAt(0, col))
datset1 = system.dataset.addRow(dataset1, dataset1.rowCount, newRow)
```

---

<div class="post-metadata">

**Author:** ![nmudge](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nmudge/32/3394_2.png) [@nmudge](https://forum.inductiveautomation.com/u/nmudge)\
**Post date:** [January 14, 2014, 4:37pm UTC](https://forum.inductiveautomation.com/t/getting-a-row-from-a-dataset/7833/2 "2014-01-14T16:37:40Z")

</div>

This is a little better and works:

```auto
row = list(system.dataset.toPyDataSet(dataset2)[0])
dataset1 = system.dataset.addRow(dataset1, dataset1.rowCount, row)
```

---

<div class="post-metadata">

**Author:** ![JGJohnson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jgjohnson/32/29582_2.png) [@JGJohnson](https://forum.inductiveautomation.com/u/JGJohnson)\
**Post date:** [January 14, 2014, 7:05pm UTC](https://forum.inductiveautomation.com/t/getting-a-row-from-a-dataset/7833/3 "2014-01-14T19:05:07Z")

</div>

[quote=“nmudge”]This is a little better and works:

`
row = list(system.dataset.toPyDataSet(dataset2)[0])
dataset1 = system.dataset.addRow(dataset1, dataset1.rowCount, row)
`[/quote]

Nice! So on a python dataset you can reference a row using brackets?

row = myPyDataset[0]

---

<div class="post-metadata">

**Author:** ![nmudge](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nmudge/32/3394_2.png) [@nmudge](https://forum.inductiveautomation.com/u/nmudge)\
**Post date:** [January 14, 2014, 7:17pm UTC](https://forum.inductiveautomation.com/t/getting-a-row-from-a-dataset/7833/4 "2014-01-14T19:17:51Z")

</div>

Yes, that is correct.

You can also access values this way too:

```auto
print myPyDataset[0]["col name"]
```

or

```auto
print myPyDataset[0][3]
```
