# Ordered data set based on user

**URL:** <https://forum.inductiveautomation.com/t/ordered-data-set-based-on-user/6169>\
**Category:** Ignition\
**Created:** [April 5, 2013, 7:58pm UTC](https://forum.inductiveautomation.com/t/ordered-data-set-based-on-user/6169 "2013-04-05T19:58:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![stuartd](https://avatars.discourse-cdn.com/v4/letter/s/ecae2f/32.png) [@stuartd](https://forum.inductiveautomation.com/u/stuartd)\
**Post date:** [April 5, 2013, 7:58pm UTC](https://forum.inductiveautomation.com/t/ordered-data-set-based-on-user/6169/1 "2013-04-05T19:58:19Z")

</div>

I want the functionality of the .getRowsInViewOrder but instead of returning a integer with the list I would like it to return the dataset in that order.

---

<div class="post-metadata">

**Author:** ![semiano](https://avatars.discourse-cdn.com/v4/letter/s/4da419/32.png) [@semiano](https://forum.inductiveautomation.com/u/semiano)\
**Post date:** [July 29, 2014, 7:21pm UTC](https://forum.inductiveautomation.com/t/ordered-data-set-based-on-user/6169/2 "2014-07-29T19:21:23Z")

</div>

_bumping thread_ ![:thumb_left:](https://us1.discourse-cdn.com/inductiveautomation/original/1X/e26afb081ddde6df016df6ee49159cf56aaca688.gif ":thumb\_left:")

---

<div class="post-metadata">

**Author:** ![adamaustin](https://avatars.discourse-cdn.com/v4/letter/a/5f8ce5/32.png) [@adamaustin](https://forum.inductiveautomation.com/u/adamaustin)\
**Post date:** [July 29, 2014, 7:53pm UTC](https://forum.inductiveautomation.com/t/ordered-data-set-based-on-user/6169/3 "2014-07-29T19:53:58Z")

</div>

Try this:

```auto
tbl = event.source.parent.getComponent("Table")
a = tbl.getRowsInViewOrder()
b = system.dataset.toPyDataSet(tbl.data)

z = map(list,zip(a,b))
z.sort(key=lambda x: x[0])
sorted_data = [row[1] for row in z]

print str(sorted_data)
for row in sorted_data:
	#do whatever
	print([x for x in row])
```

Change your variable names to protect the guilty.
