Focal Point
Compound Report with Page X of Y

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/7221048331

March 17, 2005, 02:14 PM
reFOCUSing
Compound Report with Page X of Y
Heres my issue, I'm trying to create a compound report that shows the current page and the total number of pages on each page of the report. Normally, what I've done in the footing is "Page
Does anyone have any ideas how do to this?

What I'm thinking I will have to do is concatenate the data sets together using MORE or MATCH FILE to create one large data set.
I so don't know if playing with FOCFIRSTPAGE will help me.

Here is some sample code of what I'm trying to do:

SET COMPOUND = OPEN NOBREAK
TABLE FILE CAR
FOOTING
"Page PRINT
RETAIL_COST
DEALER_COST
BY
COUNTRY
BY
CAR
ON TABLE PCHOLD FORMAT PDF
END

SET COMPOUND = OPEN NOBREAK
TABLE FILE CAR
FOOTING
"Page SUM
RETAIL_COST
BY
COUNTRY
ON TABLE PCHOLD FORMAT PDF
END

SET COMPOUND = CLOSE
TABLE FILE CAR
FOOTING
"Page PRINT
DEALER_COST
BY
CAR
ON TABLE PCHOLD FORMAT PDF
END

This message has been edited. Last edited by: <Mabel>,
March 18, 2005, 07:12 AM
<JG>
At the moment the only solution is to run the reports twice and use the final value of &focnextpage -1

I've moded the code for an example. Notice I'e removed the NOBREAK as this screws the page numbers, also added some PAGE_BREAK's on the BY fields to gen multiple pages

-SET &CNT=0;
-SET &OFPAGE=0;
-REPEAT ENDREPEAT 2 TIMES
-SET &CNT=&CNT+1;
-SET &PCHOLD=IF &CNT EQ 1 THEN 'HOLD' ELSE 'PCHOLD';
SET FOCFIRSTPAGE = 1
SET COMPOUND = OPEN
TABLE FILE CAR
FOOTING
"Page <TABPAGENO of &OFPAGE"
PRINT RETAIL_COST DEALER_COST
BY COUNTRY PAGE-BREAK
BY CAR
ON TABLE &PCHOLD.EVAL FORMAT PDF
END
SET FOCFIRSTPAGE = &FOCNEXTPAGE
-RUN
TABLE FILE CAR
FOOTING
"Page <TABPAGENO of &OFPAGE"
SUM RETAIL_COST
BY COUNTRY PAGE-BREAK
ON TABLE &PCHOLD.EVAL FORMAT PDF
END
-RUN
SET FOCFIRSTPAGE = &FOCNEXTPAGE
SET COMPOUND = CLOSE
TABLE FILE CAR
FOOTING
"Page <TABPAGENO of &OFPAGE"
PRINT DEALER_COST
BY CAR PAGE-BREAK
ON TABLE &PCHOLD.EVAL FORMAT PDF
END
-RUN
-SET &OFPAGE=IF &CNT EQ 1 THEN &OFPAGE + &FOCNEXTPAGE -1 ELSE &OFPAGE;
-ENDREPEAT
March 18, 2005, 02:36 PM
reFOCUSing
Thanks for the help. I'll give it a try.
June 01, 2005, 03:39 PM
<new2focus>
Hi JG,

Could you please explain why are using both HOLD & PCHOLD in this? What is the difference between these 2 options?

Thanks in advance!
June 01, 2005, 04:01 PM
<JG>
The reason is that the HOLD in the first loop through does not return the output to the user but runs the reports so that you can get the final page value that you need.

The second loop using PCHOLD generates the output that is returned to the user