Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing issues - page limit

Status
Not open for further replies.

perl1963

Programmer
Feb 26, 2003
19
0
0
US
I am printing a report in a fox 2.6a application the report has 11170 pages. In preview mode the report is displayed fine all pages. When print mode is selected the report stops at 9999. Is there a setting? I looked at the _PEPAGE and it is set to 32768. My thoughts are to split the record set, but it seems like this is unnecesary based on being able to scroll the the last page in display mode.

Any suggestion would be appreciated.


Perl

Perl
Forum-Financial.com
 
The suggestions over in the VFP forum say to use PDF to print, Crystal Reports. Or upgrade to at least version 7 of Visual FoxPro. They can handle at least 32767 pages.

thread184-716037
thread184-494866
thread184-257894
 
Why not do something like change the _PAGENO variable to a UDF such as MyPageNo()? Then:
Code:
STORE 0 TO lPageCount
DO WHILE !EOF()
   REPORT FORM MyReport NEXT 1000
ENDDO


FUNCTION MyPageNo
lPageCount = lPageCount + 1
RETURN lPageCount


-Dave S.-
[cheers]
Even more Fox stuff at:
 
Dave so from the above code, am I correct in that the _PAGENO is limited so the UDF will insure a proper page count is reported and the DO WHILE !EOF() will call the report and print in burse of 1000?



Perl
Forum-Financial.com
 
..._PAGENO is limited...
I don't know that it's specifically _PAGENO that is limited. But there is a limitation somewhere, probably resulting from the 16 bit code FoxPro was written in.
But yes, a UDF would reflect the correct page number if that's the reason you need to print all records in one job.
If the page number isn't as important, then obviously you could leave out the _PAGENO and UDF and just run the loop anyway.

...DO WHILE !EOF() will call the report and print in burse of 1000?
That is correct.
And if it's going goofy at 9999, you could really use any number less than that also. Not just 1000.


-Dave S.-
[cheers]
Even more Fox stuff at:
 
Nice way to get the page numbers right by running multiple reports.

One difficulty with the workaround described above is that if a report is making grand totals and it has to be spilt into 2 or more smaller reports, then you will get separate grand totals. The grand totals will have to be calculated separately ahead of time and then dropped into the end of the report(s) as variables, or else you'll have to get out your pen to add them up.
 
Somehow this line doesn't look right:

Code:
REPORT FORM MyReport NEXT 1000

Am I missing something? Doesn't this report example by DSummZZZ actually print the NEXT <records>? Shouldn't this example use WHILE as shown below? Sorry, I haven't tested this...
Code:
STORE 0 TO lPageCount, lPageForm
lMaxPages = 9000
DO WHILE !EOF()
   lPageForm = 0
   REPORT FORM MyReport WHILE lPageForm <= lMaxPages
ENDDO

FUNCTION MyPageNo
lPageCount = lPageCount + 1
lPageForm = lPageForm + 1
RETURN lPageCount
dbMark
 
dbMark,

You're right on the totals issue, they would also have to be calc'ed in the UDF. I was just trying to show a simple example or how to get around the page limitation issue.
You could use some report variables or whatever and keep your own running totals.

Somehow this line doesn't look right:

REPORT FORM MyReport NEXT 1000


Actually, you're right. It should read:
REPORT FORM MyReport NEXT 1000 TO PRINT

But I don't really know why you would need this statement:
lPageForm <= lMaxPages
Unless you are trying to limit the total number of pages printed.

What happens in the DO WHILE ... loop, is that the report will get called as long as the record pointer isn't at EOF(). The record pointer will move through the first 1000 records printing them, then it stays put until the next iteration of the loop. It will then print until either another 1000 records has printed or it reaches EOF().
The gotcha I didn't include here, is that it starts with the current record, and prints 1000 more. So a SKIP needed to be included or the last page of the previously printed 1000 will be the same as the first page of the next 1000. Hopefully that is not too confusing.
Here is what it should look like:
Code:
STORE 0 TO lPageCount
DO WHILE !EOF()
   REPORT FORM MyReport NEXT 1000 TO PRINT
   SKIP
ENDDO


FUNCTION MyPageNo
lPageCount = lPageCount + 1
RETURN lPageCount


-Dave S.-
[cheers]
Even more Fox stuff at:
 
And I was making my comments and example based not on the number of records per report but on the number of pages, as I thought that was the key issue at hand and so I tried to work the concept from that direction. Yes, as written it would have kept starting over at the beginning. My example perhaps should have included a blend of NEXT and WHILE and who knows what else. I'll have to drop this, it's late and time is gone.
 
Thanks Dave

Your solution was right on only issue I had, and I believe it is because I am no sending exact numbers to the print job, is I added:

IF (!EOF())
SKIP
ENDIF

Again I am saying NEXT maxrecs, so for a record set of 11000
I do two interation and the second one say NEXT maxrecs when there are only 1001 instead of 9999 so the print job returns when the eof is the current record and just plain SKIP breaks.

Again thanks much!

Perl
Forum-Financial.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top