# Getting sort order for Power Table?

**URL:** <https://forum.inductiveautomation.com/t/getting-sort-order-for-power-table/15963>\
**Category:** Ignition\
**Created:** [November 10, 2017, 5:03pm UTC](https://forum.inductiveautomation.com/t/getting-sort-order-for-power-table/15963 "2017-11-10T17:03:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mschell1978](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mschell1978/32/8996_2.png) [@mschell1978](https://forum.inductiveautomation.com/u/mschell1978)\
**Post date:** [November 10, 2017, 5:03pm UTC](https://forum.inductiveautomation.com/t/getting-sort-order-for-power-table/15963/1 "2017-11-10T17:03:02Z")

</div>

Is there a way to get the sorted row indices from a power table?  
Basically, after a user has applied the sorting to columns, I need a list of the sorted indices so I can process the underlying dataset based on this sorting info.

(using the viewDataset attribute is not sufficient because the underlying ID field is hidden on the component display)

---

<div class="post-metadata">

**Author:** ![mrogers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mrogers/32/4110_2.png) [@mrogers](https://forum.inductiveautomation.com/u/mrogers)\
**Post date:** [November 10, 2017, 6:44pm UTC](https://forum.inductiveautomation.com/t/getting-sort-order-for-power-table/15963/2 "2017-11-10T18:44:15Z")

</div>

I’m not sure if theres a prettier way to do this but depending on how unique the data is and how many columns with unique data there is, you might be able to create a sort of key column that would be identical between the viewDataset attriibute and the normal data attribute. So for each row the key value would be something like “col1 + col2 + col3…”, including all columns that are on both .data and .viewDataset. You can find the original ID based on what key in the .data matches a given key in .viewDataset.

---

<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:** [November 10, 2017, 9:36pm UTC](https://forum.inductiveautomation.com/t/getting-sort-order-for-power-table/15963/3 "2017-11-10T21:36:03Z")

</div>

Try `table.getRowsInViewOrder()`. (-:
