7.1 Introduction to Calculations
Calculations can be used to calculate the values of data objects using the values of other data objects and report variables. Calculations can be used to calculate numeric, text, and date data objects.
Individual calculations can be created manually, or calculations such as subtotals can be created automatically.
A calculation is a type of Data Adaptor attached to a data object. You must therefore create a data object around the text you wish to automate (see Data Objects).
Calculations and rounding
Report Authority always uses the rounded and displayed values in the calculations even though the underlying data objects may contain more precise values. This prevents any apparent casting errors due to rounding.
E.g. if the underlying values of two data objects are each “0.5” but are displayed rounded to the nearest unit (“1”), then a simple addition of these two objects will return “2”, rather than “1”.
Useful calculations
- Cross-referencing - A data object can be set to equal the value of another data object (which itself could be a calculation).
- Absolute value - This will set the value of a data object equal to the positive value of another data object.
- Word selection (such as “profit” or “loss”) - Often used in conjunction with another data object using the Absolute value function to create a sentence such as “The entity made a loss of £3m” where the word “profit” or “loss” will be dependent on the value of another object and the profit or loss will always be shown positively.
- Inserting today’s date - The data adaptor will always show the current date.
Data Object Highlighting Mode
If the data object highlighting mode is set to Adaptor Type, all data objects with calculation adaptors will be highlighted in yellow: