# Self reference in expression bindings

**URL:** <https://forum.inductiveautomation.com/t/self-reference-in-expression-bindings/61717>\
**Category:** Ignition\
**Tags:** ignition81, vision, scripting\
**Created:** [July 11, 2022, 9:12am UTC](https://forum.inductiveautomation.com/t/self-reference-in-expression-bindings/61717 "2022-07-11T09:12:35Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![zxcslo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zxcslo/32/61610_2.png) [@zxcslo](https://forum.inductiveautomation.com/u/zxcslo)\
**Post date:** [July 11, 2022, 9:12am UTC](https://forum.inductiveautomation.com/t/self-reference-in-expression-bindings/61717/1 "2022-07-11T09:12:35Z")

</div>

Is it possible to self-reference a component in the expression binding on the same component?

 ![Screenshot_18](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/8/a87685e05b992c440d158e568ee9510df3d3c140.png)  
Currently, I’m using this:

```auto
if(isNull({Root Container.ContainerObesalo.lblStatusOkretanjeBubnjeva.vrednost}),
	{Root Container.ContainerObesalo.lblStatusOkretanjeBubnjeva.text},
	case({Root Container.ContainerObesalo.lblStatusOkretanjeBubnjeva.vrednost},
		0,"ISKLJUČENO",
		1,"NAPRED",
		2,"NAZAD",
		4,"GREŠKA",
		"ISKLJUČENO"
		)
	)

```

But it’s very time-consuming…  
I was also trying like this:

```auto
if(isNull({self.vrednost}),
	{self.text},
	case({self.vrednost},
		0,"ISKLJUČENO",
		1,"NAPRED",
		2,"NAZAD",
		4,"GREŠKA",
		"ISKLJUČENO"
		)
	)

```

Obviously, that doesn’t work, but I almost can’t believe, that expression self-referencing isn’t possible…?

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [July 11, 2022, 12:19pm UTC](https://forum.inductiveautomation.com/t/self-reference-in-expression-bindings/61717/2 "2022-07-11T12:19:06Z")

</div>

Is all of this data coming from a single UDT instance (hopefully)? If so it might be easier to do it in the UDT.

I do wish that you could self-reference.

---

<div class="post-metadata">

**Author:** ![zxcslo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zxcslo/32/61610_2.png) [@zxcslo](https://forum.inductiveautomation.com/u/zxcslo)\
**Post date:** [July 11, 2022, 12:35pm UTC](https://forum.inductiveautomation.com/t/self-reference-in-expression-bindings/61717/3 "2022-07-11T12:35:53Z")

</div>

No, there is no UDT…  
This property ({Root Container.ContainerObesalo.lblStatusOkretanjeBubnjeva. **vrednost** }) is binded to a normal tag.

---

<div class="post-metadata">

**Author:** ![Brandon\_Peterson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/brandon_peterson/32/32960_2.png) [@Brandon\_Peterson](https://forum.inductiveautomation.com/u/Brandon_Peterson)\
**Post date:** [July 11, 2022, 12:55pm UTC](https://forum.inductiveautomation.com/t/self-reference-in-expression-bindings/61717/4 "2022-07-11T12:55:05Z")

</div>

I’m not sure whether you can use the `self` keyword on a binding like this (I would think you can). But you definitely can’t reference a binding (`{Root Container.ContainerObesalo.lblStatusOkretanjeBubnjeva.text}`) in its own definition. A binding _replaces_ the value and therefore can’t reference it.

Give this field a default value, and you shouldn’t get an error anymore:

```auto
if(isNull({Root Container.ContainerObesalo.lblStatusOkretanjeBubnjeva.vrednost}),
	"<Default Value>",
	case({Root Container.ContainerObesalo.lblStatusOkretanjeBubnjeva.vrednost},
		0,"ISKLJUČENO",
		1,"NAPRED",
		2,"NAZAD",
		4,"GREŠKA",
		"ISKLJUČENO"
		)
	)

```

If that works, then try using the `self` keyword to see if you can shorten your code.

---

<div class="post-metadata">

**Author:** ![zxcslo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zxcslo/32/61610_2.png) [@zxcslo](https://forum.inductiveautomation.com/u/zxcslo)\
**Post date:** [July 11, 2022, 4:11pm UTC](https://forum.inductiveautomation.com/t/self-reference-in-expression-bindings/61717/5 "2022-07-11T16:11:13Z")

</div>

I don’t get any errors.  
My first/current code (`{with full property path}`) works just fine.  
Expression code with `{self.text}` and `{self.vrednost}` also doesn’t throw any errors, it just won’t work.

What I mean/need is something like this in SQL query binding:

 ![Screenshot_49](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/b/7b9e99975e7ec40fb38af76d4589adcaac358e20.png)

---

<div class="post-metadata">

**Author:** ![jeroen.werkbrouck](https://avatars.discourse-cdn.com/v4/letter/j/c89c15/32.png) [@jeroen.werkbrouck](https://forum.inductiveautomation.com/u/jeroen.werkbrouck)\
**Post date:** [November 14, 2025, 12:05pm UTC](https://forum.inductiveautomation.com/t/self-reference-in-expression-bindings/61717/6 "2025-11-14T12:05:54Z")

</div>

Hello zxcslo,

Have you found a solution for that?

With kind regards

---

<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:** [November 14, 2025, 1:43pm UTC](https://forum.inductiveautomation.com/t/self-reference-in-expression-bindings/61717/7 "2025-11-14T13:43:20Z")

</div>

It isn't available on expression bindings because it makes a circular reference, and weird behavior on expression startup.

---

<div class="post-metadata">

**Author:** ![jeroen.werkbrouck](https://avatars.discourse-cdn.com/v4/letter/j/c89c15/32.png) [@jeroen.werkbrouck](https://forum.inductiveautomation.com/u/jeroen.werkbrouck)\
**Post date:** [November 19, 2025, 12:21pm UTC](https://forum.inductiveautomation.com/t/self-reference-in-expression-bindings/61717/8 "2025-11-19T12:21:02Z")

</div>

Hello pturmel,

Thanks for the reply.  
I wanted to link the name of a template instance to the mouseover text.  
But by doing this once manually and copy/paste the template, it keeps working, so that works well enough for me.
