I would put two custom properties on the component: prevValue
and currValue
(or some other names you like). prevValue
would use a tag history binding that would return the same value as the script in your post. currValue would be bound to the current value. The actual display property of your component (text, intValue, doubleValue, etc.) has an expression binding subtracting currValue
from prevValue
. This solution is all bindings, no scripting. I think that’s preferable where possible.