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:
  1. 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.

  1. In the Properties grid for x+y, set the Calculation Type to BeforeSave.
    The Edit Formula dialog appears,
  2. Enter the required formula, then click OK.
    for example:
    Value = Object._x + Object._y
    return Value
  3. In Window Manager, add the three attributes to the required window.
  4. For x and y, in the Window Manager Properties grid, set Is calculate on change to True.
  5. 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.