Previous Topic: Identifying the FunctionNext Topic: Including Report Functions in Footings


Obtaining Multiple Values

You can request summary values for one or more fields. For example, assume that the total amount for year‑to‑date sales (CUSTOMER.YTD) is obtained with the total outstanding amount owed (CUSTOMER.OPEN$). To display these values in summary notation, specify the Detail fill‑in as shown in the following screen:

=> ‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑ IDEAL : RPT DETAIL DEFN. RPT CUSTRPT (001) TEST SYS: DOC DISP Field Name, Literal, Sort Break Function Column Function, or L A L S I T M M A H W Command Arithmetic Expression V / V K N O A I V D ID Tab Edit Pattern L D L P D T X N G G TH ‑‑‑‑‑‑ ‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑ ‑ ‑ ‑ ‑ ‑ ‑ ‑ ‑ ‑ ‑ ‑‑ ‑‑‑ ‑‑‑‑‑‑‑‑‑‑‑‑‑ ====== =========== T O P ======= = = = = = = = = = = == === ============= 000400 CUSTOMER.NAME _ _ _ _ _ _ _ _ _ U __ ___ _____________ 000500 CUSTOMER.CITY _ _ _ _ _ _ _ _ _ U __ ___ _____________ 000600 CUSTOMER.STATE _ _ 1 2 N _ _ _ _ _ __ ___ _____________ 000700 CUSTOMER.OPEN$ _ _ _ _ _ S _ _ _ U __ ___ Z,ZZZ,ZZ9.99_ 000700 CUSTOMER.YTD _ _ _ _ _ S _ _ _ U __ ___ Z,ZZZ,ZZ9.99_ ====== ========= B O T T O M === = = = = = = = = = = == === =============

The output for the state of Texas displays as the following:

Customer Name City Open Dollar Year‑To‑Date ** STATE TX AFTON INDUSTRIES DALLAS 1,234.51 42,394.82 GULF LAND USA DALLAS 7,100.00 10,452.00 TEXAS LIFE & CASUALTY DALLAS 543.21 987.32 CHEMICAL MUTUAL FORT WORTH 931.72 5,231.00 PALMOLIVE INNS FORT WORTH 758.93 9,789.22 UNION TRANSPORTATION GALVESTON 0.00 401.22 SOUTHLAND STORES HOUSTON 342.91 6,349.21 TOTAL 10,911.28 75,604.79

Notice the keyword TOTAL on the left of the last line in the sample output. The total values for the two columns print under the appropriate headings.

Similarly, you can specify more than one value for each field. If the Detail fill‑in from the previous example was modified to specify all of the functions in summary format, the function summary lines for the state of Texas displays as the following:

Customer Name City Open Dollar Year‑To‑Date UNION TRANSPORTATION GALVESTON 0.00 401.22 SOUTHLAND STORES HOUSTON 342.91 6,349.21 TOTAL 10,911.28 75,604.79 AVERAGE 1,558.75 10,800.68 MINIMUM 0.00 401.22 MAXIMUM 7,100.00 42,394.82

Note: There are times when a function provides the information that is needed without displaying the data in the details. For example, you can expand the previous report to include the number of customers that have no accounts receivable. To do this, a working data variable is created. This variable is a one‑digit numeric named NOORDCTR. In the FOR construct, the value of NOORDCTR is set to 0 when the customer has an outstanding balance and to 1 when the customer does not.

FOR EACH CUSTOMER
. . .
   IF OPEN$ EQ 0
      SET NOORDCTR = 1
   ELSE
      SET NOORDCTR = 0
   ENDIF
   . . .
   PRODUCE CUSTRPT
ENDFOR

On the Detail fill‑in, the TOT function is requested as an annotated value for the field NOORDCTR. The field width is set to 0. This prevents the data and any headings from printing with the detail lines.

=> ‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑ IDEAL : RPT DETAIL DEFN. RPT CUSTRPT (001) TEST SYS: DOC DISP Field Name, Literal, Sort Break Function Column Function, or L A L S I T M M A H W Command Arithmetic Expression V / V K N O A I V D ID Tab Edit Pattern L D L P D T X N G G TH ‑‑‑‑‑‑ ‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑ ‑ ‑ ‑ ‑ ‑ ‑ ‑ ‑ ‑ ‑ ‑‑ ‑‑‑ ‑‑‑‑‑‑‑‑‑‑‑‑‑ ====== =========== T O P ======= = = = = = = = = = = == === ============= 000400 CUSTOMER.NAME _ _ _ _ _ _ _ _ _ U __ ___ _____________ 000500 CUSTOMER.CITY _ _ _ _ _ _ _ _ _ U __ ___ _____________ 000600 CUSTOMER.STATE _ _ 1 2 N _ _ _ _ _ __ ___ _____________ 000700 CUSTOMER.OPEN$ _ _ _ _ _ S _ _ _ U __ ___ Z,ZZZ,ZZ9.99_ 000800 CUSTOMER.YTD _ _ _ _ _ S _ _ _ U __ ___ Z,ZZZ,ZZ9.99_ 000900 NOORDCTR _ _ _ _ _ A _ _ _ U 00 ___ _____________ ====== ========= B O T T O M === = = = = = = = = = = == === =============

Since a user‑defined heading for NOORDCTR is defined on the Column Heading fill‑in as CUSTOMERS HAVING NO OUTSTANDING ORDERS:, the following annotated total prints when two customers have no outstanding orders:

TOTAL CUSTOMERS HAVING NO OUTSTANDING ORDERS: 2