Power table Selected Cell value Expression - Question

I have a Standard Table Component(Table1)that is displaying values associated with operator request.
I also have a Power Table Component(PwrTable2) on the same screen that is populated based on the selected row from Table1. PwrTable2 gets its Dataset from the following Query.

SELECT * FROM maint WHERE id LIKE {Root Container.SelectedCell}

Root Container.SelectedCell is a Custom Property.
This works well, as long as a row is selected on Table1, otherwise I get the following Error.

Exception: Error executing expression binding on
Batching.Root Container.SelectedCell
caused by ArrayIndexOutOfBoundsException: -1

What can i do to resolve this error?

I would populate PwrTable2 by either by a propertyChange script on Table1. That way you can also put in an alternate case if there isn’t a row selected.

Either that or on your RootContainer.SelectedCell binding, make it so that it has an expression where if it is -1 substitute a different value that makes sense for your system.

You can easily wrap your expression in a try function to supply a default value.

Thank you for you help, grietveld and Sandered17.
Considering my existing expressions, Sanderd17’s solution was the easiest to implement .

Again, Thank you both for your help.