7.3 Editing Calculations
The expression editor is used to edit the calculation’s expression:
Functions, report variables and data objects can be inserted into the expression by navigating the tree below the expression and double clicking on the object in the right hand panel.
Inserting Functions
Report Authority contains many useful functions, the notation and explanation is described in the blue box when selected.
Using Report Variables
Report variables can also be inserted into expressions. These can be particularly useful in logical expressions where you could begin the expression such as “IF([Entity Code] = “12345678”,…”
Using Data Objects
Data objects can be inserted into the expression by expanding the “Segments” parent in the tree and selecting the segment that contains the data object you wish to use in the expression. Data objects can be inserted into the expression by double-clicking on them.
The data object will be named as follows:
- By their explicit name, or if not named;
- By their inherited name based in the first XBRL tag attached to the object, or if not tagged;
- By their segment path and position number.
Naming data objects
It is not necessary to provide a data object with an explicit name to use it in a calculation. However, it can be much more efficient to name data objects you know you intend to use in calculations so that you can refer to them directly by their name - rather than having to browse for their dynamic name that has been automatically assigned by the expression editor. To name a data object, type a value in the Value Editor panel:
Note that objects with a unique explicit name can be simply typed into the expression editor, such as “Profit * [Tax rate]”. If the explicit name contains a space, the name must be enclosed with square brackets ( [ ] ).
The data object name is dynamically created which means that you do not have to modify the expression if its explicit name is changed, the segment is renamed, the position number altered or XBRL tag is changed.
Calculations and Data Object Types
The value returned by an expression must be compatible with the data object type otherwise you will receive an error. If the expression is to return text, as in “profit”, the object must be a text data object. The same applies to calculations that return numbers and dates.
In the example above, the expression is returning a text string of “profit”, but the data object is of the type Monetary.
Examples of Useful Expressions
a. Automating a sentence with both words and values
This expression returns either "profit" or "loss".
This expression will always return the absolute value of the current period's profit
b. Automating the Gross profit label in the statement of comprehensive income:
This is a nested if statement that checks the signage of gross profit in both the current and prior periods.