Calculations when values change
You will often want a calculation to update immediately whenever one of the attributes used by the calculations changes.
For example, if you have two numeric attributes on a window that are added together to give a third attribute, you will want the third attribute to update immediately if you change one of the other attributes:
if you change x or y, the x+y field updates immediately
To set up a calculation field that updates when you change its dependants:
- In Object Designer, create the x, y, and x+y attributes.
Set the Default Value for x and y to 0, as described in Handling null values by setting a default value.
- In the Properties grid for x+y, set the Calculation Type to BeforeSave.
The Edit Formula dialog appears, - Enter the required formula, then click OK.
for example:
Value = Object._x + Object._y
return Value - In Window Manager, add the three attributes to the required window.
- For x and y, in the Window Manager Properties grid, set Is calculate on change to True.
- Click .
The window is saved. When you update x or y on the window, x+y immediately updates.
Is calculate on change has not been implemented in Workspaces, so you will not see this update until you reload the window.