Focal Point
[CLOSED] Page number in compound pdf report

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

October 27, 2014, 04:53 PM
WFDevConsultant
[CLOSED] Page number in compound pdf report
I am trying to get the Page count in the report by doing
-SET &CNT=1;
-*SET PRINTPLUS=ON
-REPEAT PRGLOOP 2 TIMES
SET FOCFIRSTPAGE = 1
SET COMPOUND = OPEN
TABLE FILE CAR
ON TABLE SUBHEAD
"Page HEADING
"COUNTRY "
PRINT COUNTRY
ON TABLE SET PAGE-NUM OFF
ON TABLE PCHOLD FORMAT PDF
END
-RUN

SET FOCFIRSTPAGE = &FOCNEXTPAGE

TABLE FILE CAR
ON TABLE SUBHEAD
"Page HEADING
"CAR"
PRINT CAR
ON TABLE SET PAGE-NUM OFF
ON TABLE PCHOLD FORMAT PDF
END
-RUN

-SET &COMPVAL=IF &CNT EQ 2 THEN 'CLOSE' ELSE '';
SET COMPOUND =&COMPVAL ;
SET FOCFIRSTPAGE = &FOCNEXTPAGE
TABLE FILE CAR
ON TABLE SUBHEAD
"Page HEADING
"MODEL"
PRINT MODEL
ON TABLE SET PAGE-NUM OFF
ON TABLE PCHOLD FORMAT PDF
END
-RUN
-SET &CNT=&CNT+1;
-PRGLOOP
-EXIT

This message has been edited. Last edited by: <Kathryn Henning>,


8.2.06
Windows, All Formats
October 28, 2014, 05:29 AM
Alan B
Firstly, please place your code between code tags, the right hand red icon.

From the documentation:
TABLASTPAGE is supported only for a single report, not pooled or compound reports. A separate page count is generated for each report in a compound report.

So this could only be achieved by using Document Composer and that syntax, where ibi-page-number and ibi-total-pages are available.


Alan.
WF 7.705/8.007
October 28, 2014, 09:41 AM
WFDevConsultant
Thanks Alan.

Are there any other way we can get it?


8.2.06
Windows, All Formats
October 28, 2014, 11:58 AM
Mighty Max
In your loop you will have to manage the page number.
At the start of the loop you set FOCFIRSTPAGE to 1 every time.
This can be a variable.
At the end of the loop you will set its value appropriately.

To get the total page count you will basically have to run the report twice.
First run you will add a page counter variable to the loop.
Second run you will use the page counter variable instead of TABLASTPAGE.


WebFOCUS 8.1.05M Unix Self-Service/MRE/Report Caster - Outputs Excel, PDF, HTML, Flat Files
October 28, 2014, 02:15 PM
WFDevConsultant
Thanks Mighty.


8.2.06
Windows, All Formats
October 29, 2014, 10:34 AM
susannah
agree with Max. i would suggest that you set your LINES-PER-PAGE to some value that you are sure will fit on a page, taking into account WRAPping, number of lines taken up by your header/footer, phases of the moon, etc.
Say you have 3 reports in your output; Run each of the 3 fex bits, just generating the report data lines, with ON TABLE HOLD AS ...
Save each of the line counts.
-SET &howmany1 = &LINES ;
then divide that saved value by your lines-per-page setting (eg 60), to figure out the number of pages, and be sure to round UP. (i'm assuming you'll page-break after each output table);
Sum up all three of your final page counts, and then that number is what you put in your footing in place of
<TABLASTPAGE.

This is how i do it, anyway.

This message has been edited. Last edited by: susannah,




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
October 29, 2014, 11:29 AM
WFDevConsultant
quote:
Reply

Thanks Susannah. That helps.


8.2.06
Windows, All Formats
October 31, 2014, 10:55 AM
WFDevConsultant
Susannah,

I tried your suggestion but the 'SET LINES' command not working proper.

-DEFAULT &&NOOFPAGE=2;

SET LINES=5;

TABLE FILE CAR
PRINT CAR
ON TABLE HOLD AS TEST
END
-RUN
-SET &LINE1=&LINES;

TABLE FILE CAR
PRINT MODEL
ON TABLE HOLD AS TEST1
END
-RUN

-SET &LINE2=&LINES;
-SET &LINE3=&LINE1 + &LINE2;
-SET &&NOOFPAGE=IF &LINE3 GT 5 THEN 2 ELSE 1;
-TYPE NOOFPAGE &&NOOFPAGE



TABLE FILE CAR
ON TABLE SUBHEAD
"Page <TABPAGENO of &&NOOFPAGE"
HEADING
"CAR"
PRINT CAR
ON TABLE SET PAGE-NUM OFF
ON TABLE PCHOLD FORMAT PDF OPEN NOBREAK
END
-RUN


TABLE FILE CAR
ON TABLE SUBHEAD
"Page <TABPAGENO of &&NOOFPAGE"
HEADING
"MODEL"
PRINT MODEL
ON TABLE SET PAGE-NUM OFF
ON TABLE PCHOLD FORMAT PDF CLOSE
END
-RUN

-EXIT


8.2.06
Windows, All Formats
October 31, 2014, 11:57 AM
MartinY
Try without the semi-column after your SET command.

quote:
SET LINES=5;


Becomes
SET LINES=5



WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
October 31, 2014, 01:23 PM
WFDevConsultant
I didn't have the semicolon there. It was a typo.


8.2.06
Windows, All Formats