Help changing from indirect binding to an expression with an IF

I'm trying to adjust an existing indirect binding we have to be an expression since I need to add some simple IF logic.

The current indirect binding:
[default]Knitting/KnittingMachines[{text},78]

With text defined as the Property:
{../RowIndex.props.text}

In this way, RowIndex is used to identify which knitting machine tag to pull the value of field 78 (TargetQuantity) from.

This works, but I need to change it to an expression so that it should conditionally select which field to pull the value from. It should use field 25 (TargetOrder) unless it's value is zero, and then it should use 29 (BagTarget) instead.

Something like this, though this contains about nested paths:

if({[default]Knitting/KnittingMachines[{../RowIndex.props.text},25]} = 0,
   {[default]Knitting/KnittingMachines[{../RowIndex.props.text},29]},
   {[default]Knitting/KnittingMachines[{../RowIndex.props.text},25]}
)

I've tried a number of variations on this, but am not getting anywhere and would love some help.

Thanks!

Keep the indirect binding. Add a custom property that does the logic to select the desired index. Include that property as a second substitution in the indirect binding.

Create a custom properties which use the indirect bindings, then reference those properties in your expression.

if({self.custom.knittingMachine} = 0, 
   {self.custom.BadTarget}, 
   {self.custom.TargetOrder}
)

Note: Be sure to use the property selector to get the correct paths to the properties.