Layout Calculations
Layout calculations are those which are performed when the report is
formatted. You can define these kinds of layout calculations:
---------------------------------------------------------------------------------------------
| | |
| Type of Calculation | Orientation |
| | |
---------------------------------------------------------------------------------------------
| | |
| column calculations | vertical |
| | |
| row calculations | horizontal |
| (layout calculated items) | |
| | |
| combination of both--Either: | |
| | |
| column calculations on layout calculated items | vertical |
| | |
| or layout calculated items that use column calculation results | horizontal |
| as arguments | |
| | |
---------------------------------------------------------------------------------------------
Column Calculations
Column calculations summarize data for a break. For example, you can
specify a break on the total sales values for a sales area.
Column calculations can be defined for any numeric item (type N, R, and
I) and can be one of these types of calculations:
---------------------------------------------------------------------------------------------
| | |
| Calculation | Result |
| | |
---------------------------------------------------------------------------------------------
| | |
| TOTAL | total value |
| | |
| AVG | average value |
| | |
| MIN | least value |
| | |
| MAX | largest value |
| | |
| COUNT | count of the values (NO_VALUEs are not |
| | counted) |
| | |
| CALC | row calculation results |
| | |
---------------------------------------------------------------------------------------------
To perform a column calculation on an item
1. At the Define Lines screen, type the calculation type in the
ColCalc field for the item.
2. Type an optional suffix after the calculation type if you want to
reset the break level. Use one of these suffixes:
--------------------------------------------------------------------------------------------
| | |
| R | To reset on the report break |
| | |
| P | To reset on the page break |
| | |
| 1-9 | To reset on one of the break levels (1 through 9). |
| | |
| no suffix | The default. The column calculation value is reset on the |
| | current break. |
| | |
--------------------------------------------------------------------------------------------
Running column calculations begin again after being reset.
3. If you want to specify the source level for the calculation, type
an optional suffix preceded by a comma after the calculation type.
Use one of these suffixes:
--------------------------------------------------------------------------------------------
| | |
| ,R | To use the report break as the source |
| | |
| ,P | To use the page break as the source |
| | |
| ,1-,9 | To use one of the break levels (1 through 9) as the source |
| | |
| no suffix | The default. The value is taken from the detail line. |
| | |
--------------------------------------------------------------------------------------------
Column calculations with a particular source level are accumulated
when the break footing (not heading) of the source level occurs.
4. If you are finished defining the line for that item, press Enter.
If you specify a calculation for an array item that does not have an
index number, the column calculation is performed for all array
components. If an index is specified, only that array component is used
for the column calculation.
Example: Array items
In the following example of a Define Lines screen, for each array item
(TURNOVER (i)), a TOTAL calculation is specified. This prints total
values for each specific array item.
By comparison, in the next example the item TURNOVER is specified without
an index, and TOTAL is entered for the column calculation. Here, the
whole array will be totalled.
The item name for column calculations on array items is specified in one
of two ways:
--------------------------------------------------------------------------------------------
| | |
| With an index | If you want to print only the item. |
| | |
| Without an index | If you use the column calculation result of the array item in a |
| | calculation formula, or if you want to write it to an output |
| | file. See Chapter 9, Multi-pass Reporting. |
| | |
--------------------------------------------------------------------------------------------
Example: Resetting the calculation at break levels
If you specified a column calculation of TOTAL for item TURNOVER-MTD in
the level 1 Break Footing Lineset, the value would be reset to zero at
each level 1 break. You specify the default by stating the column
calculation without a suffix.
You can specify a different reset levels for a column calculation by
appending the break level at which you want the value reset to the name
of the column calculation. For example, to have a column calculation run
through the whole report, you add an R after the column calculation name:
TOTAL R.
Example: Using a source level for the calculation
In this example, the Sales Area Report is produced from the following
final access table:
---------------------------------------------------------------------------------------------
| |
| Sales-Area Cust-# PY-TO Inv-# Amt |
| |
---------------------------------------------------------------------------------------------
| |
| EAST 100888 2439.75 IN5325 3029.85 |
| |
| EAST 100888 2439.75 IN5331 850.00 |
| |
| EAST 100946 19765.50 IN5335 1775.00 |
| |
| EAST 100946 19765.50 IN5340 2125.00 |
| |
| EAST 100946 19765.50 IN5341 13400.00 |
| |
| EAST 100946 19765.50 IN5342 4137.50 |
| |
| NORTH 100114 85113.85 IN5346 700.00 |
| |
| NORTH 100114 85113.85 IN5326 7745.20 |
| |
| NORTH 100537 800.00 IN3338 600.00 |
| |
---------------------------------------------------------------------------------------------
Suppose the column calculation TOTAL is used on the item TURNOVER-PY
(turnover for the previous year) without a source level.
The value for TURNOVER-PY will be added for every detail. However, the
report requires that the turnover be added only at the break on
CUSTOMER-NO, since the turnover has only one value per customer. If it
is added at every detail, the turnover would have a value equal to the
actual turnover times the number of records for the same customer.
For this report a source level is specified for TURNOVER-PY on the Define
Lines screen:
The resulting report looks like this:
_______________________________________________________________________________________
| |
| |
| SALES AREA: EAST |
| Customer: 100888 |
| |
| Invoice-No Amount |
| ---------- ------- |
| IN5325 3029.85 |
| IN5331 850.00 |
| -------- |
| Total Invoice Amount: 3879.85 Previous-year Turnover: 2439.75 |
| |
| |
| Customer: 100946 |
| |
| Invoice-No Amount |
| ---------- ------- |
| IN5335 1775.00 |
| IN5340 2125.00 |
| IN5341 13400.00 |
| IN5342 4137.50 |
| -------- |
| Total Invoice Amount: 21437.50 Previous-year Turnover: 19765.50|
| |
| Total Sales Area Invoice Amount: 25317.35 Previous-year Turnover: 22105.25|
| |
| SALES AREA: NORTH |
| |
| Customer: ............... |
| |
| ........... |
| ........... |
_______________________________________________________________________________________
Example: Using both reset and source levels
You can specify both the source and reset level for column calculations.
The reset level is the first character after the column calculation,
followed by a comma, followed by a character for the source level. See
the following table:
Restrictions on Column Calculations
Restrictions on column calculations are as follows:
* For break heading/footing and detail linesets, the reset level
must be less than the source level.
* Report heading and footing linesets cannot have a reset level.