Previous Topic: Primary Detail GroupNext Topic: Sequencing the Report Data


Multiple Secondary Groups

A primary group can have more than one secondary group. For example, the following Detail fill‑in contains two secondary groups. The first defines the order identification number and date and the second defines a literal. The literal prints when a customer does not have any outstanding orders.

=>

‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑ 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 <<CUSTINF>> GROUP          _ _ _ _ _ _ _ _ _ _ __ ___ _____________ 000500 CUSTOMER.CUSTID            _ _ _ _ _ _ _ _ _ _ __ ___ _____________ 000600 CUSTOMER.NAME              _ _ _ _ _ _ _ _ _ _ __ ___ _____________ 000700 CUSTOMER.CITY              _ _ _ _ _ _ _ _ _ _ __ ___ _____________ 000800 CUSTOMER.STATE             _ _ _ _ _ _ _ _ _ _ __ ___ _____________ 000900 CUSTOMER.ZIP               _ _ _ _ _ _ _ _ _ _ __ ___ _____________ 001000 _________________________ _ _ _ _ _ _ _ _ _ _ __ L01 _____________ 001100 <<ORDINF>> GROUP           _ _ _ _ _ _ _ _ _ _ __ ___ _____________ 001200 ORDER.ORDID                _ _ _ _ _ _ _ _ _ _ __ 008 _____________ 001300 $DATE('MM/DD/YY',;         _ _ _ _ _ _ _ _ _ _ 08 +04 _____________ 001400 DATE=ORDDT,TEM='YYMMDD')   _ _ _ _ _ _ _ _ _ _ __ ___ _____________ 001500 _________________________ _ _ _ _ _ _ _ _ _ _ __ L01 _____________ 001600 <<NOORDER>> GROUP          _ _ _ _ _ _ _ _ _ _ __ ___ _____________ 001700 'CUSTOMER HAS NO ORDERS'   _ _ _ _ _ _ _ _ _ _ __ 008 _____________ 001800 _________________________ _ _ _ _ _ _ _ _ _ _ __ L01 _____________ ====== ========= B O T T O M === = = = = = = = = = = == === =============

The following program prints the appropriate secondary group:

FOR EACH CUSTOMER
    PRODUCE CUSTRPT.CUSTINF
    FOR EACH ORDER
       WHERE ORDER.CUSTID EQ CUSTOMER.CUSTID
        PRODUCE CUSTRPT.ORDINF
    WHEN NONE
       PRODUCE CUSTRPT.NOORDER
    ENDFOR
ENDFOR

The output now appears as follows:

A0090 INTERNATIONAL BANK CORP    NEW YORK       NY 100059989 CUSTOMER HAS NO ORDERS A0130 SUN DIAL CITRUS GROWERS    LOS ANGELES    CA 902130052 1021 11/08/93 1024 01/04/94 A0150 IMPERIAL BANKCORP          NEW YORK       NY 100190000 1023 12/24/93 B0230 CHEMICAL MUTUAL            FORT WORTH     TX 761026102 1013 11/05/94 . . .

Note: Produce the primary detail before any secondary details, otherwise, the output is unpredictable.