Hi all,
How to trigger/receive an event when only a certain property of a (object) variable has changed?
Currently, i can see only ‘variable onChange’ events in the events’ list.
My use-case: when one property of a variable changes, i want to recalculate and update another property in the same variable. If i use the ‘variable onChange’ event for this, it results in an infinite loop, which immediately crashes everything (Composer/Debugger/Preview app).
Would appreciate any advise on this.
Thanks!
Hi there
This is not supported and I would generally go with some other way of representing this logic.
Instead of changing object properties based on changes on other object properties (which as you mention causes infinite recursion), I would listen for the original change, calculate any new values and then use ‘set variable’ flow function with a formula to set a new object as the variable value.
For example, if you use ‘set variable’ with assigned value set to a formula such as: SET_KEY(pageVars.obj, 'name', 'Alice')
, it will effectively update the property, because the object will be otherwise the original one apart from having the ‘name’ property set to a new value.
Hi @Akseli_Virtanen, thanks for the answer.
Yeah, now I’m using manual triggers to make sure that the flows do not become recursive.