Change Field and Title on PAGE-BREAK

Daniel Braunschvig of SRL Products, also a key contributor on Focal Point, kindly shared this technique on Focal Point.

By Daniel Braunschvig, SRL Products

Our customer wanted to sort a report by SEATS, COUNTRY, CAR and BODYTYPE, for 4 and 5 SEATS, PAGE-BREAK for SEATS.
Display is RCOST and SALES when SEATS=4, DCOST only for SEATS=5.
This is what we came up with:

DEFINE FILE CAR
F1/I6=IF SEATS EQ 4 THEN RCOST ELSE DCOST;
F2/I6S=IF SEATS EQ 4 THEN SALES ELSE 0;
TF1/A6 =IF SEATS EQ 4 THEN 'RETAIL' ELSE 'DEALER';
TF2/A5 =IF SEATS EQ 4 THEN 'SALES' ELSE ' ';
END
TABLE FILE CAR
PRINT 
     F1 AS ''
     F2 AS ''
BY  SEATS AS ''
BY  COUNTRY AS ''
BY  CAR AS ''
BY  BODYTYPE AS ''
     
ON SEATS PAGE-BREAK
HEADING
"SEATS<+0>COUNTRY<+0>CAR<+0>BODYTYPE < TF1 < TF2"
IF SEATS EQ 4 OR 5
ON TABLE NOTOTAL
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
$
TYPE=REPORT,
     BORDER-TOP=LIGHT,
     BORDER-BOTTOM=LIGHT,
     BORDER-LEFT=LIGHT,
     BORDER-RIGHT=LIGHT,
$
TYPE=DATA,
     COLUMN=N6,
     BACKCOLOR=RGB(255 255 153),
$
TYPE=DATA,
     COLUMN=N5,
     BACKCOLOR=RGB(204 255 204),
$
TYPE=DATA,
     COLUMN=N4,
     BACKCOLOR=RGB(255 255 153),
$
TYPE=DATA,
     COLUMN=N3,
     BACKCOLOR=RGB(204 255 204),
$
TYPE=DATA,
     COLUMN=N2,
     BACKCOLOR=RGB(255 255 153),
$
TYPE=DATA,
     COLUMN=N1,
     BACKCOLOR=RGB(204 255 204),
$
TYPE=TITLE,
     COLUMN=N6,
     BACKCOLOR=RGB(255 255 153),
$
TYPE=TITLE,
     COLUMN=N5,
     BACKCOLOR=RGB(204 255 204),
$
TYPE=TITLE,
     COLUMN=N4,
     BACKCOLOR=RGB(255 255 153),
$
TYPE=TITLE,
     COLUMN=N3,
     BACKCOLOR=RGB(204 255 204),
$
TYPE=TITLE,
     COLUMN=N2,
     BACKCOLOR=RGB(255 255 153),
$
TYPE=TITLE,
     COLUMN=N1,
     BACKCOLOR=RGB(204 255 204),
$
TYPE=HEADING,
     HEADALIGN=BODY,
$
TYPE=HEADING,
     LINE=1,
     OBJECT=TEXT,
     ITEM=1,
     BACKCOLOR=RGB(204 255 204),
     COLSPAN=1,
     JUSTIFY=LEFT,
$
TYPE=HEADING,
     LINE=1,
     OBJECT=TEXT,
     ITEM=2,
     BACKCOLOR=RGB(255 255 153),
     COLSPAN=1,
     JUSTIFY=LEFT,
$
TYPE=HEADING,
     LINE=1,
     OBJECT=TEXT,
     ITEM=3,
     BACKCOLOR=RGB(204 255 204),
     COLSPAN=1,
     JUSTIFY=LEFT,
$
TYPE=HEADING,
     LINE=1,
     OBJECT=TEXT,
     ITEM=4,
     BACKCOLOR=RGB(255 255 153),
     COLSPAN=1,
     JUSTIFY=LEFT,
$
TYPE=HEADING,
     LINE=1,
     OBJECT=FIELD,
     ITEM=1,
     BACKCOLOR=RGB(204 255 204),
     COLSPAN=1,
     JUSTIFY=LEFT,
$
TYPE=HEADING,
     LINE=1,
     OBJECT=FIELD,
     ITEM=2,
     BACKCOLOR=RGB(255 255 153),
     COLSPAN=1,
     JUSTIFY=LEFT,
$
ENDSTYLE
END

 

Output:

Figure 1