Calculated attribute types

A Calculated attribute is a read-only field whose value is calculated based on a specified formula.

When you save a form that contains calculated attributes, Unica Plan checks the formulas to ensure that they are valid.

A Calculated attribute has the following additional basic options.

Table 1. Options for Calculated attributes
Field Description
Formula The formula that calculates the value. Any attributes that are used in the formula must be included on the same form as the calculated attribute.
Number of decimal places for the field The number of digits to display after the decimal point

Formula syntax

You can perform the following binary operations.

  • Addition (+)
  • Subtraction (-)
  • Multiplication (*)
  • Division (/)

You can perform the following operations on an arbitrary number of comma-separated operands.

  • Sum: for example, Sum(Salary, 1000, Bonus)
  • Avg: arithmetic average, for example, Avg(BudgQtr1, BudgQtr2, BudgQtr3)
  • Min: select the minimum value, for example Min(IQ, 125)
  • Max: select the maximum value, for example Max(Sale1, Sale2, Sale3, Sale4)

An operand can be any of the following.

  • A decimal constant (for example, 2.5).
  • The attribute internal name of an attribute on the current form of the following types: Money, Integer, Decimal, or Calculated. If the formula references an attribute that is not included in the form, saving the form results in an error.

Calculated attribute example

Assume the Wages form contains the following currency fields: BaseSalary, Bonus, Insurance, and FedTax. You could create a calculated field named Net pay, and enter the following formula for it: BaseSalary+Bonus-FedTax-Insurance

Example to avoid

Since you can reference one calculated field within another, take care to avoid infinite recursion. For example, consider a form with the following attributes.

  • Salary: an integer or money attribute
  • Commission = Salary + (Bonus * 0.10)
  • Bonus = (Commission * 0.5) + 1000

The Commission and Bonus attributes refer to each other, creating an infinite loop when the system attempts to calculate the values.

Grid attribute example

Calculated fields can be used in grids and on forms. A simple example is if a grid contains columns for units and cost per unit, you can create a column for the grid to represent the total cost: Units * CostPerUnit