Drilling down to selected data of Power Table

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

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']

1 Like

Add one more set of braces, plus the try:

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

Great, thank you both for the quick response!

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

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.

1 Like

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