First page Back Continue Last page Graphics

Entering a Calculation


Entering a Calculation

In the example, this Groovy expression uses a ternary operator that tests a Boolean condition (Salary!=null) to return the value of Salary if it is not null and zero otherwise. It then performs a similar calculation on the value of CommissionPct, and multiplies it by the Salary, and then returns the sum of both calculations.

To complete the attribute assignment, open the Dependencies page of the Attribute Editor, select the Salary and CommissionPct attributes in the Available list, and click Add (right-arrow) to move them to the Selected list. This ensures that a recalculation is performed if the user changes either value.

Ensure that the new transient attribute is included in all view objects that may need it.