Hi Tim,
After a lot of iterations, finally DID IT! My RVs were correctly defined but what finally jumped out at me in your dummy report was the word “virtual”. I had all true subreports and I guess that was what was messing it all up. So I started it as in your example with a virtual subreport as the ghost report, then followed it with a true subreport for the true print. And it worked! Thank you sir! Ed. From: Dataperf [mailto:[email protected]] On Behalf Of Tim Rude Sent: Friday, July 26, 2019 3:13 PM To: [email protected] Subject: Re: [Dataperf] How to print Total page count in report. First of all, are you sure you're printing RV19? i.e. Page [Page Number] of [RV19]. I don't see in your sample report where you printed RV19 so I can't tell. I've done silly things before like printing the wrong RV and can't figure out why I'm not getting the output I expect. I just created a dummy report that prints a multiline text field (containing the first 3 paragraphs from the Wikipedia page about WordPerfect) 30 times. I'm printing it only 30 chars wide so it generates a lot of pages. On the first pass where it's outputting to NUL, it counts 43 pages. Then it switches the output to TEST.TXT and does it again and successfully prints 'Page x of 43' on each page. And none of the Printer Control Codes will cause any issues unless you send a <12> (formfeed) code that triggers a page eject without DP realizing it. The STE of the report is below. I've highlighted the important bits in red, with notes in green: RV19 - Page Counter RV30 - 30 iterations of printing my dummy text RV251 - Filename for output RV86 - Used to stop the parent report (i.e. 86 it) REPORT.BASED.ON.PANEL:1 NAME:~Test Report~ REPORT.MODE:WP OUTPUT.FILENAME:~NUL~ <--- Starting with output going to NUL CREATE.DISK.FILE REPORT.INDEX: 1 TEXT.LINES=54 TOP.MARGIN=6 BOTTOM.MARGIN=0 LEFT.MARGIN=0 REPORT.FORM: FIRST.PAGE.HEADER OTHER.PAGE.HEADER TWO.LEVEL.REPORT.HEADER REPORT.BODY SET.RV:30 FORMULA:~30~ FORMULA.END; VIRTUAL.SUBREPORT.TO.PANEL:1 TO.INDEX:1 FIELD.LIST:1 <-- First Run of Subreport, going to NUL FIRST.PAGE.HEADER SET.RV:19 FORMULA:~1~ <--- Initializing RV19 to 1 in FPH FORMULA.END; ~Page ~ PAGE:~GZZZZZ9;;B~ CR OTHER.PAGE.HEADER SET.RV:19 FORMULA:~rv19 + 1~ <--- Incrementing RV19 with each new page FORMULA.END; ~Page ~ RV:1;~GZ9;;B~ CR TWO.LEVEL.REPORT.HEADER REPORT.BODY FIELD=P1F2;~A30A0~ CR SET.RV:30 FORMULA:~rv30 - 1~ FORMULA.END; REPEAT.RECORD.IF.RV:30 TWO.LEVEL.FOOTER PAGE.FOOTER SKIP.TO.PAGE.BOTTOM ~page footer~ FINAL.FOOTER SKIP.TO.PAGE.BOTTOM ~final footer~ END.SUBREPORT.FOR.PANEL:1 EJECT <--- I found that a Page Eject code here (before switching away from NUL) is needed to avoid an extraneous automatic one SET.RV:251 FORMULA:~"TEST.TXT"~ FORMULA.END; TURN.FILE.OFF BEGIN.WRITING.TO.FILENAME.IN.RV:251 <--- Switch output from NUL to actual file TURN.FILE.ON SET.PAGE.NUMBER.TO:1 <--- Reset the page number count SET.RV:30 FORMULA:~30~ FORMULA.END; VIRTUAL.SUBREPORT.TO.PANEL:1 TO.INDEX:1 FIELD.LIST:1 <--- Second run of the subreport with output actually going to file FIRST.PAGE.HEADER ~Page ~ PAGE:~GZZZZZ9;;B~ ~ of ~ RV:19;~GZZZZZ9;;B~ CR OTHER.PAGE.HEADER ~Page ~ PAGE:~GZZZZZ9;;B~ ~ of ~ RV:19;~GZZZZZ9;;B~ CR TWO.LEVEL.REPORT.HEADER REPORT.BODY FIELD=P1F2;~A30A0~ CR SET.RV:30 FORMULA:~rv30 - 1~ FORMULA.END; REPEAT.RECORD.IF.RV:30 TWO.LEVEL.FOOTER PAGE.FOOTER SKIP.TO.PAGE.BOTTOM ~page footer~ FINAL.FOOTER SKIP.TO.PAGE.BOTTOM ~final footer~ END.SUBREPORT.FOR.PANEL:1 SET.RV:86 FORMULA:~0~ FORMULA.END; STOP.REPORT.ON.RV:86 <--- This keeps the parent report from repeating. Once the 2 subs have run we're done. TWO.LEVEL.FOOTER PAGE.FOOTER FINAL.FOOTER REPORT.END; On 7/26/2019 2:43 PM, Ed Marfil, MAST UNITED wrote: Hi Tim, Tried it but didn’t work. Tried moving it around but still not counting after 2nd page. Keeps coming up page # of 2 i.e. page 4 of 2. Ed.
_______________________________________________ Dataperf mailing list [email protected] http://lists.dataperfect.nl/cgi-bin/mailman/listinfo/dataperf
