Previous Topic: Available Report FunctionsNext Topic: Calculating Values in a Footing


Using Labeled Values

You can use labeled values or variables defined in the Detail fill‑in in the heading text. See the section titled Including Other Types of Fields earlier in this chapter for information on how to specify labeled values.

For example, in a billing application, a field that contains a labeled expression is defined on the Detail fill‑in. This expression is called COST and consists of the result of multiplying the number of units ordered by the cost per unit. The calculation is not coded in the procedure; rather, the field is specified on the Detail fill‑in as the following:

COST = ITEM.COMMITQ * ITEM.UNITPRICE

Although a working data variable is not defined for the label COST, you can use it in the control break footing to print the order total. In other words, you can obtain the value in COST in the facilities of RDF. It is not available procedurally.

To print the total cost for an order, define a level‑1 control break for the order ID number, ORDER.ORDID, to cause a control break for each new order. Then define a level‑1 control break footing on the Heading fill‑in to obtain the total for COST for all items in the order using the $TOT function. This is specified as shown in the following:

=> ‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑ 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 'Thank You for Your Order' __ ___ _____________ 000500 _______________________________________________ __ L01 _____________ 000600 'Order Total:' __ 040 _____________ 000700 $TOT(COST) __ +02 _____________ ====== ===================== B O T T O M ============== == === =============

You can use the TAB specifications to align the value of $TOT(COST) with the appropriate column in the report details.

The labels for expressions on the Detail fill‑in should be unique names, not names defined for any other data (for example, working data, parameter data, columns, and so on). A compile error occurs if a reserved word is used.