# Help changing from indirect binding to an expression with an IF

**URL:** <https://forum.inductiveautomation.com/t/help-changing-from-indirect-binding-to-an-expression-with-an-if/104229>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [March 26, 2025, 12:54pm UTC](https://forum.inductiveautomation.com/t/help-changing-from-indirect-binding-to-an-expression-with-an-if/104229 "2025-03-26T12:54:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chris\_Esposito](https://avatars.discourse-cdn.com/v4/letter/c/278dde/32.png) [@Chris\_Esposito](https://forum.inductiveautomation.com/u/Chris_Esposito)\
**Post date:** [March 26, 2025, 12:54pm UTC](https://forum.inductiveautomation.com/t/help-changing-from-indirect-binding-to-an-expression-with-an-if/104229/1 "2025-03-26T12:54:22Z")

</div>

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:

```python
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!

---

<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:** [March 26, 2025, 1:07pm UTC](https://forum.inductiveautomation.com/t/help-changing-from-indirect-binding-to-an-expression-with-an-if/104229/2 "2025-03-26T13:07:50Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [March 26, 2025, 1:09pm UTC](https://forum.inductiveautomation.com/t/help-changing-from-indirect-binding-to-an-expression-with-an-if/104229/3 "2025-03-26T13:09:21Z")

</div>

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

```python
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.
