Previous Topic: Including Report Functions in FootingsNext Topic: Using Labeled Values


Available Report Functions

You can use a number of report functions in report footings. You can also use some report functions in report headings and detail. You can specify more than one function. The value that the function returns is based on those details processed in the specified limit, which is defined by the type of footing: page break by the page footing, <<PF>>, or control break level by the control break footing, <<BF>> with level number.

The following are the report functions that are valid only in footings:

$TOT(field)

Displays the accumulated total value.

$CTOT(field)

Displays the accumulated report total value.

$AVG(field)

Displays the average for details processed.

$MIN(field)

Displays the minimum value encountered.

$MAX(field)

Displays the maximum value encountered.

$OCC(field)

Displays the count of non‑null occurrences of field, where field represents the Detail fill‑in field name or label. Array elements are not permitted.

The following are functions that are valid in report detail, headings, and footings:

$RPT‑DATE

Displays the report date, printed in page heading or footing.

$RPT‑PAGE

Displays the page number, printed in page heading or footing.

$OCC

Displays the count of primary PRODUCE statements executed.

Note: If you specify a string function, a WIDTH specification is required.

For example, to obtain the average for accounts receivable (the CUSTOMER.OPEN$ field), specify the function $AVG as the following:

$AVG(CUSTOMER.OPEN$)

Note: The function $OCC is particularly useful since it can obtain the count of non‑null occurrences of a primary or secondary field. For example, a report is defined to print customer information as the primary group level and a list of outstanding orders as a secondary group level. You can use $OCC to obtain a count of the number of outstanding orders for each customer. Assuming that a level‑1 control break is defined for customer name and that ORDER.ORDID is a secondary group field containing unique order IDs, the entry in the Heading fill‑in for a control break footing to contain the count value is shown in the following screen:

=> ‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑ IDEAL : RPT HEADING/FOOTING RPT CUSTRPT (001) TEST SYS: DOC DISP Field Name, Literal, Function, Column Command or Arithmetic Expression Wid Tab Edit Pattern ‑‑‑‑‑‑ ‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑ ‑‑ ‑‑‑ ‑‑‑‑‑‑‑‑‑‑‑‑‑ ====== ==================== T O P ===================== == === ============= 000300 <<BF>> LEVEL 1 __ ___ _____________ 000400 'Total Number of Orders:' __ ___ _____________ 000500 $OCC(ORDER.ORDID) __ +02 _____________ ====== ===================== B O T T O M ============== == === =============