# Expression Tags Evaluation

**URL:** <https://forum.inductiveautomation.com/t/expression-tags-evaluation/38897>\
**Category:** Ignition\
**Tags:** ignition80\
**Created:** [September 21, 2020, 3:51pm UTC](https://forum.inductiveautomation.com/t/expression-tags-evaluation/38897 "2020-09-21T15:51:11Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![pgmo](https://avatars.discourse-cdn.com/v4/letter/p/d07c76/32.png) [@pgmo](https://forum.inductiveautomation.com/u/pgmo)\
**Post date:** [September 21, 2020, 3:51pm UTC](https://forum.inductiveautomation.com/t/expression-tags-evaluation/38897/1 "2020-09-21T15:51:11Z")

</div>

I’d like to better understand the way **expression tags** are evaluated. Suppose I have two tags in the _Tags_ root folder _Tag1_ and _Tag2_. I then define an expression tag _TagResult_ whose expression is `{[~]Tag1}+{[~]Tag2}`. How is _TagResult_ evaluated? Is _TagResult_ evaluated whenever either _Tag1_ or _Tag2_ change or is it evaluated according to its _Tag Group_, i.e. if the Tag Group _Rate_ is 500 msec, the calculation in _TagResult_ will be carried out every 500 msec?

Thanks in advance, 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:** [September 21, 2020, 7:01pm UTC](https://forum.inductiveautomation.com/t/expression-tags-evaluation/38897/2 "2020-09-21T19:01:09Z")

</div>

You get to pick which you want. If in an event driven tag group, it’ll update when any referenced tag changes. Otherwise it’ll be unconditionally recalculated every time the group executes.

---

<div class="post-metadata">

**Author:** ![pgmo](https://avatars.discourse-cdn.com/v4/letter/p/d07c76/32.png) [@pgmo](https://forum.inductiveautomation.com/u/pgmo)\
**Post date:** [September 21, 2020, 9:11pm UTC](https://forum.inductiveautomation.com/t/expression-tags-evaluation/38897/3 "2020-09-21T21:11:56Z")

</div>

Many thanks for your answer. One more question: what about _Expression bindings_ on components properties? Are they updated just when one item in the expression changes value, i.e. event driven?

---

<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:** [September 22, 2020, 4:10am UTC](https://forum.inductiveautomation.com/t/expression-tags-evaluation/38897/4 "2020-09-22T04:10:01Z")

</div>

Yes, component property bindings are event driven.

---

<div class="post-metadata">

**Author:** ![Neo](https://avatars.discourse-cdn.com/v4/letter/n/9fc348/32.png) [@Neo](https://forum.inductiveautomation.com/u/Neo)\
**Post date:** [September 22, 2020, 5:04am UTC](https://forum.inductiveautomation.com/t/expression-tags-evaluation/38897/5 "2020-09-22T05:04:11Z")

</div>

Since we are on this topic, can I ask a question regarding the component property bindings evaluation.

When a window having components property bindings as well as custom properties with tag, expression, SQL query bindings in opened, is there a specific sequence (may be alphabetically or components binding first and then custom properties) in which these bindings are evaluated or they are evaluated randomly?

and just to confirm, function called in `invokeLater` gets executed after all above bindings’ evaluation is completed, right?

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:** [September 22, 2020, 12:09pm UTC](https://forum.inductiveautomation.com/t/expression-tags-evaluation/38897/6 "2020-09-22T12:09:09Z")

</div>

I do not know of any imposed order on the initial evaluation of bindings. However, tag and query bindings are not synchronous. Something kicked off with invokeLater could execute in the dead time before tags or queries get their first values.

---

<div class="post-metadata">

**Author:** ![Neo](https://avatars.discourse-cdn.com/v4/letter/n/9fc348/32.png) [@Neo](https://forum.inductiveautomation.com/u/Neo)\
**Post date:** [September 23, 2020, 4:48am UTC](https://forum.inductiveautomation.com/t/expression-tags-evaluation/38897/7 "2020-09-23T04:48:01Z")

</div>

@pturmel Thank you for your reply.

I am calling a function on `propertyChange` event of one of the custom properties through `invokeLater`. This function reads other custom properties. All custom properties have tag or expression bindings.

> Something kicked off with invokeLater could execute in the dead time before tags or queries get their first values.

In above scenario, this function will not work correctly. Is there any workaround for it?

---

<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:** [September 23, 2020, 1:02pm UTC](https://forum.inductiveautomation.com/t/expression-tags-evaluation/38897/8 "2020-09-23T13:02:06Z")

</div>

Use propertyChange events to keep track of updates to all the properties you need. Trigger your special function when you have them.

---

<div class="post-metadata">

**Author:** ![Neo](https://avatars.discourse-cdn.com/v4/letter/n/9fc348/32.png) [@Neo](https://forum.inductiveautomation.com/u/Neo)\
**Post date:** [September 24, 2020, 8:37am UTC](https://forum.inductiveautomation.com/t/expression-tags-evaluation/38897/9 "2020-09-24T08:37:56Z")

</div>

Ok, will update accordingly.  
Thank you for your reply.
