Creating Calculations


When you create content, you are not restricted to the fields that exist directly in your data source. You can add calculations to automate summations and other mathematical tasks related to your data fields. You can specify operators, fields, variables, and functions when creating a calculation. If you can generate the information you want from the existing data, you can create a temporary field to evaluate and display it. A temporary field is a field whose value is not stored in the data source, but can be calculated from the data that is there. A temporary field takes up no storage space in the data source, and is created only when needed.

You can create two types of temporary fields (a virtual field and a calculated value), which differ in how they are evaluated:

  • A virtual field (DEFINE) is evaluated as each record that meets the selection criteria is retrieved from the data source. The result of the expression is treated as though it were a real field stored in the data source.
  • A calculated value (COMPUTE) is evaluated after all the data that meets the selection criteria is retrieved, sorted, and summed. Therefore, the calculation is performed using the aggregated values of the fields.