# Move Table Rows Up/Down

**URL:** <https://forum.inductiveautomation.com/t/move-table-rows-up-down/56683>\
**Category:** Ignition\
**Created:** [March 1, 2022, 7:18pm UTC](https://forum.inductiveautomation.com/t/move-table-rows-up-down/56683 "2022-03-01T19:18:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dee\_Duncan](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dee_duncan/32/31786_2.png) [@Dee\_Duncan](https://forum.inductiveautomation.com/u/Dee_Duncan)\
**Post date:** [March 1, 2022, 7:18pm UTC](https://forum.inductiveautomation.com/t/move-table-rows-up-down/56683/1 "2022-03-01T19:18:09Z")

</div>

Hello,  
I am using a power table component which is connected to a database table.  
Is there a way to move selected rows up and down using buttons?

Thanks

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [March 1, 2022, 7:27pm UTC](https://forum.inductiveautomation.com/t/move-table-rows-up-down/56683/2 "2022-03-01T19:27:32Z")

</div>

In vision, the power tables have `selectedColumn` and `selectedRow` properties you can manipulate with scripts

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [March 1, 2022, 8:41pm UTC](https://forum.inductiveautomation.com/t/move-table-rows-up-down/56683/3 "2022-03-01T20:41:27Z")

</div>

I assume you’re using a query to populate your data, in which case the order of rows is determined by your select query. You can manipulate this dataset in script, but it will revert back to the query order whenever the query is executed again. To fix that, you’ll most likely need to add a new order field to your sql table and update that

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [March 1, 2022, 8:58pm UTC](https://forum.inductiveautomation.com/t/move-table-rows-up-down/56683/4 "2022-03-01T20:58:03Z")

</div>

I didn’t even read the question that way, I guess I miss interpreted. I’ve done this before like @nminchin suggested, I used a `priority` column to allow the re-ordering of the data.
