Expression Tags Evaluation

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

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.

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?

Yes, component property bindings are event driven.

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?


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.

@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?

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

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