# Drilling down to selected data of Power Table

**URL:** <https://forum.inductiveautomation.com/t/drilling-down-to-selected-data-of-power-table/21637>\
**Category:** Ignition\
**Tags:** ignition79, scripting\
**Created:** [January 2, 2019, 5:40am UTC](https://forum.inductiveautomation.com/t/drilling-down-to-selected-data-of-power-table/21637 "2019-01-02T05:40:02Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![mriederer](https://avatars.discourse-cdn.com/v4/letter/m/4af34b/32.png) [@mriederer](https://forum.inductiveautomation.com/u/mriederer)\
**Post date:** [January 2, 2019, 5:40am UTC](https://forum.inductiveautomation.com/t/drilling-down-to-selected-data-of-power-table/21637/1 "2019-01-02T05:40:02Z")

</div>

Hi,

I have built a database editing tool similar to the Inductive University video titled “Edit Data in Database”, however I can’t figure out to bind data in the selected row to a custom property (e.g. ‘id’). It’s not really described in the video and I found a work-around by binding the ‘id’ property to the expression: {Root Container.Power Table.selectedRow}+1… but this is a poor solution that fails after rows are deleted.

My other thought was to try {Root Container.Power Table.data}[‘id’], but this only provides the id of the first row.

How can I access data from a selected row to bind a custom property? I would like to perform this using the expression binding and not need to use {Root Container.Power Table.selectedRow} with a SQL query, which might not work anyways.

Thank you,

Michael

---

<div class="post-metadata">

**Author:** ![Sanderd17](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sanderd17/32/8735_2.png) [@Sanderd17](https://forum.inductiveautomation.com/u/Sanderd17)\
**Post date:** [January 2, 2019, 9:16am UTC](https://forum.inductiveautomation.com/t/drilling-down-to-selected-data-of-power-table/21637/2 "2019-01-02T09:16:36Z")

</div>

This should work as an expression. Though it will throw errors when no row is selected. To solve that, you can wrap it in a `try`, and return a safe default when no row is selected.

`{Root Container.Power Table.data}[Root Container.Power Table.selectedRow,'id']`

---

<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:** [January 2, 2019, 1:37pm UTC](https://forum.inductiveautomation.com/t/drilling-down-to-selected-data-of-power-table/21637/3 "2019-01-02T13:37:20Z")

</div>

Add one more set of braces, plus the try:

```auto
try({Root Container.Power Table.data}[{Root Container.Power Table.selectedRow},'id'], 0)

```

---

<div class="post-metadata">

**Author:** ![mriederer](https://avatars.discourse-cdn.com/v4/letter/m/4af34b/32.png) [@mriederer](https://forum.inductiveautomation.com/u/mriederer)\
**Post date:** [January 2, 2019, 6:24pm UTC](https://forum.inductiveautomation.com/t/drilling-down-to-selected-data-of-power-table/21637/4 "2019-01-02T18:24:20Z")

</div>

Great, thank you both for the quick response!

---

<div class="post-metadata">

**Author:** ![Jackson\_Chilberg](https://avatars.discourse-cdn.com/v4/letter/j/e47c2d/32.png) [@Jackson\_Chilberg](https://forum.inductiveautomation.com/u/Jackson_Chilberg)\
**Post date:** [January 4, 2024, 3:22pm UTC](https://forum.inductiveautomation.com/t/drilling-down-to-selected-data-of-power-table/21637/6 "2024-01-04T15:22:15Z")

</div>

While attempting this function, it only ever displays whatever number i have at the end of the try statement. Why is it doing this?

---

<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:** [January 4, 2024, 3:24pm UTC](https://forum.inductiveautomation.com/t/drilling-down-to-selected-data-of-power-table/21637/8 "2024-01-04T15:24:05Z")

</div>

Well, that means your syntax (or something) for the first argument to `try()` is producing an error, so it delivers the fallback. The point of `try()` is to do that when you **expect** an error for certain cases.

If you aren't expecting an error, don't use the `try()` at all, so you can see the error.

---

<div class="post-metadata">

**Author:** ![Jackson\_Chilberg](https://avatars.discourse-cdn.com/v4/letter/j/e47c2d/32.png) [@Jackson\_Chilberg](https://forum.inductiveautomation.com/u/Jackson_Chilberg)\
**Post date:** [January 4, 2024, 3:25pm UTC](https://forum.inductiveautomation.com/t/drilling-down-to-selected-data-of-power-table/21637/9 "2024-01-04T15:25:25Z")

</div>

I was using the column header as opposed to the actual column name in my database. Thanks for the quick reply!
