Property Change Runs twice on only 1 change

I'm trying to run a script every single time a value is changed in a numeric entry field. I need this templatized and I will be running this script on all sorts of components like checkboxes and multi state buttons etc...

The issue: When making the template I would press play and test out the "property change" script by changing the numeric value, and that would write to a table once like intended (seen below). This worked great as you can see, but as soon as I put a instance of that template anywhere and change the value from the instance it logs twice. Is there a solution for this because it basically makes the propertyChange event handler useless in any template instances.


1 Like

Does that query change the value in the field you are running the script on?
if so that would cause a double run, due to the value changing after the query runs?

I suppose I can just use a "prevVal" custom property on the window and maybe use a KeyPressed for the "enterkey" and check there and hope that only runs once? I feel like this is not the right way to do it though.

No it just basically logs the previous value and the new value in a table and what time for a custom audit log which is why I really don't want it to show twice.

You can compare event.newValue and event.oldValue

if event.propertyName == 'value' and event.oldValue <> event.newValue:

That won't work unfortunatly. The new and old value are different in both times it logs as seen in the picture :/.