HP 3000 Manuals

Row Calculations (Layout Calculated Items) [ HP ALLBASE/BRW Reference Manual ] MPE/iX 5.0 Documentation


HP ALLBASE/BRW Reference Manual

Row Calculations (Layout Calculated Items) 

Row calculations are layout calculated items.  They are calculated when
the report is formatted.

Layout calculated items have these 
characteristics: 

   *   They can be any one of these item types:
              N - fixed point numeric
              R - floating=point fixed
              I - integer
              S - string
              D - date
              T - time

   *   They can be calculated from:
              source table items
              other calculated items or functions, including column
              calculations
              parameters or constants

   *   They cannot be used for:
              formulas for table calculated items
              relation conditions
              table functions

   *   By default, they are calculated for each detail lineset but you
       can specify that they be calculated for specific linesets.

To define row calculations 

   1.  Choose Layout Calc Item on the Define Report screen or on the
       Define Lineset screen.

   2.  Type the name of the item, result type, result length, and numeric
       result precision in the appropriate fields.

[]
3. Choose Add Item. 4. Choose Define Formula. 5. At the Layout Calc Item Formula screen, type the calculation formula.
[]
6. Press Enter. To calculate an item on another lineset 1. Go to the Define Lines screen. 2. Type the name of the item in the Item field. 3. Type the position and line for the item in the Pos and Line fields. 4. Type CALC in the ColCalc field for that item. 5. Type any other information as appropriate for that item (such as numeric precision or suppression of repetition). 6. Press Enter. When a layout calculated item is specified with CALC in a lineset, it has the following characteristics * It is calculated when the lineset for which it is specified is printed. * It uses a column calculation as an argument in its formula, if the corresponding item and the column calculation are specified in the same lineset. * Other items used as arguments have the same numeric precision as specified in the lineset containing the layout calculated item. Example: Row calculations based on column calculations Suppose you want to calculate the percentage of variance (VARIANCE-%) between two column total values. The layout calculated item and its formula are defined on the Layout Calc Item screen and the Layout Calc Item Formula screen. The formula for VARIANCE-% is: 100 * (actual - budget) / budget On the Define Lines screen, the calculated item VARIANCE-% is specified as shown here:
[]
Here is an example of the report using these items: _________________________________________________ | | | Actual Budget Variance-%| | ------ ------ ----------| | 500 250 100.00 | | 300 250 20.00 | | 900 450 100.00 | | ------ ------ ----------| | | | Totals: 1700 950 78.95% | | | _________________________________________________ VARIANCE-% is calculated each time the value of the item account changes. Because CALC is specified in the ColCalc field for this item, the total values of arguments ACTUAL and BUDGET are used to find the percentage of variance of these totals. In this example, if TOTAL had been specified instead of CALC, the result would be 220%.
NOTE On the Define Lines screen, HP ALLBASE/BRW uses the definition of the argument items found in the ColCalc or NumPrec field. For example, a numeric precision for ACTUAL and BUDGET could also be specified in the above example. The percentage of variance would then be calculated from the totals using this precision.
Precision of Numbers The precision of numbers in column calculation can be controlled by using any number type: fixed-point numeric (N), integer (I), or real (R). You define numeric precision by specifying a number and method code at one of several screens: * the Define Lines screen * the Layout Calc Item screen * the Table Calc Item screen The number, as shown in the following table, indicates the power of 10 or 10th exponent that indicates the precision. ------------------------------------------------------------------------------------------ | | | Valid number range for type N: -6 through 12; | | | | for type I: 0 through 8. | | | | for type R: -90 through 76 | | | ------------------------------------------------------------------------------------------ Use one of the following method codes to indicate how superfluous digits are to be treated: --------------------------------------------------------------------------------------------- | | | | Method Code | Digits are: | | | | --------------------------------------------------------------------------------------------- | | | | R | rounded | | | | | T | truncated | | | | | C | ceiled | | | | --------------------------------------------------------------------------------------------- T means truncate any remainder. C means round up if the remainder is non-zero. The default method is to round. In the configuration file you specify whether the exact half is to be rounded up or down. See Chapter 17 . Some examples of how to use numeric precision are shown below. Example: Controlling numeric precision Suppose you want to obtain total sales values in K$ (where $1000.00 = 1K) for printing or other calculations. In this example, the total is built from the original (unchanged) sales values. First, you specify the item on the Define Lines screen as shown in this break footing lineset:
[]
To print sales values in K$, you specify scaling on the Item Edits screen, as shown here:
[]
To obtain total sales values where the total is built from single sales values changed to K$, specify the item in the detail lineset on the Define Lines screen as shown here:
[]
And in the break footing lineset with a TOTAL in the ColCal field as shown here:
[]
Example: Controlling numeric precision As another example, if you wanted to obtain the result of the layout calculated item tax-amount with two decimals, you would specify -2R as the numeric precision.


MPE/iX 5.0 Documentation