You can only use $CALC in the headings sections of report definitions. Its primary purpose is to combine report functions in report headings.
This function has the following format:
$CALC
You can calculate values in the control break and page footing specifications and the results included with the footing text. The $CALC function performs the calculations.
For example, you can use two columns in the CUSTOMER table, OPEN$ and YRTODATE, to compute the difference between the outstanding balance after processing the current orders and the previous outstanding balance. The calculation is coded for the control break footing on the Heading fill‑in. The value is printed when a level‑1 control break, based on state, occurs. The calculation is specified as:
$CALC ( $TOT(CUSTOMER.YRTODATE) ‑ $TOT(CUSTOMER.OPEN$) )
When specifying $CALC, you can specify any valid arithmetic expression. The expression can include parenthesis, operators, report functions, field names, and numeric values. All fields and functions must be numeric. Field names must be unique names or labels defined in the primary detail group.
Valid operators include:
+ ‑ * / $SQRT
Example
You can use $CALC to calculate the standard deviation. For example, to obtain the standard deviation for the value in OPEN$, a field containing the outstanding amount owed for each customer, a labeled detail expression is specified on the Detail fill‑in as:
OPEN2 = OPEN$ ** 2
The calculation in the footing on the Heading fill‑in is specified as:
$CALC ($SQRT($OCC(OPEN$) * $TOT(OPEN2) ‑ $TOT(OPEN$) * TOT(OPEN$))
/ $OCC(OPEN$))
|
Copyright © 2015 CA Technologies.
All rights reserved.
|
|