# Saving last selected row in table

**URL:** <https://forum.inductiveautomation.com/t/saving-last-selected-row-in-table/80043>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [October 4, 2023, 10:22pm UTC](https://forum.inductiveautomation.com/t/saving-last-selected-row-in-table/80043 "2023-10-04T22:22:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bwagner](https://avatars.discourse-cdn.com/v4/letter/b/7feea3/32.png) [@bwagner](https://forum.inductiveautomation.com/u/bwagner)\
**Post date:** [October 4, 2023, 10:22pm UTC](https://forum.inductiveautomation.com/t/saving-last-selected-row-in-table/80043/1 "2023-10-04T22:22:36Z")

</div>

I have a table that has batches for an operator to select to queue data to a plc. They have to navigate to another screen sometimes and when they come back to the schedule screen the batch that was selected is no longer selected. Is there a way to save that selected row? The data is binded to a query. I also have persistence on for the data and the selected row, but nothing I am trying is working.

---

<div class="post-metadata">

**Author:** ![humphrey.daniel](https://avatars.discourse-cdn.com/v4/letter/h/8e8cbc/32.png) [@humphrey.daniel](https://forum.inductiveautomation.com/u/humphrey.daniel)\
**Post date:** [October 4, 2023, 11:15pm UTC](https://forum.inductiveautomation.com/t/saving-last-selected-row-in-table/80043/2 "2023-10-04T23:15:41Z")

</div>

The logic that comes to my mind is to store whatever uniquely identifies the selected row in a variable. I wouldn't use the row number as the next query might give a new dataset.

Each time you show the table, check if a row matches the identity you stored, and select it.

I don't have Ignition specific details, I'm just an admirer of the product.

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [October 4, 2023, 11:32pm UTC](https://forum.inductiveautomation.com/t/saving-last-selected-row-in-table/80043/3 "2023-10-04T23:32:20Z")

</div>

If I'm understanding your explanation correctly, you have 1 table that is used for selecting a Batch ID or similar, and then another that shows additional data about the selected batch, correct?.

You could make 2 custom properties at the session level, `selectedBatch` and `selectedBatchDetails`. Bidirectionally bind the first table's selection property to `selectedBatch` and have your query for the batch data on `selectedBatchDetails`, which uses the necessary data from `selectedBatch` to fetch the needed data. Bind the second table's data value to the `selectedBathDetails` property.

Persistence only means that the system will save and use the value you see in the designer as the value for that property during binding startup and before bindings are evaluated.

---

<div class="post-metadata">

**Author:** ![bwagner](https://avatars.discourse-cdn.com/v4/letter/b/7feea3/32.png) [@bwagner](https://forum.inductiveautomation.com/u/bwagner)\
**Post date:** [October 5, 2023, 2:23pm UTC](https://forum.inductiveautomation.com/t/saving-last-selected-row-in-table/80043/4 "2023-10-05T14:23:47Z")

</div>

I created the session custom property and bidirectionally binded it to the selected row on the table. I also had to bind the column for it to work, but I just used an expression and binded it to the name of the column. It works great now. Thank you for the help.
