Report Variables
Report variables are essential in allowing you to perform and keep track of a series of calculations on a financial report. Up to 4000 user variables (depending on the memory available on your computer) can be defined in a single report.
Report variables are distinguished from account code references and group codes by the & (and) symbol. The following are all valid report variables:
[&totalsales]
[&equity]
[&netprofit]
Report variables are used in conjunction with functions to store, and later retrieve, the results of calculations. Consider a simple example:
@add(10, 25, &total)
The value 10 is added to the value 25 and the addition is stored in the report variable &total. The function will print 35. Note also that when you are storing the result of a calculation in a user variable, there is no need to specify the left and right square brackets. However, if you later wish to retrieve this result, square brackets must be used. For example:
The total is: @add(10, 25, &total)
Repeat again: [&total]
A number of results can be added to a user variable. For example:
@add(10, 10, &total)
@add(10, [&total], &total)
@add(10, [&total], &total)
By the time the third instruction is executed, &total will contain the value of 40. Note that when a function is used to store the new result of a calculation, the old result of the calculation is cleared. For example:
@add(10, 10, &total)
@add(50, 50, &total)
The variable &total will hold the result of the last calculation (50 plus 50), which is 100.
The following section is extracted from a report. Two user variables are created. The first, &totalsales adds together the period activity group totals for the groups 'sales' and 'otherincome'. The second, &netprofit, is used to hold the result of the second calculation. In this case, the user variable [&totalsales] is subtracted from the period activity for the group 'expenses'
The names of user variables can be up to 14 characters in length. After this, the rest of the name is ignored. For example, 'cost_of_sale_this_year' will be treated as the same variable as 'cost_of_sale_th'.
_______________________
Related Topics: