Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Help with _pageno variable...
Message
From
15/02/1999 07:02:15
 
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
00186805
Message ID:
00187624
Views:
25
>>>I am trying to have my report summary band ALWAYS print at the bottom of the last page on the report. (using VFP6)
>>>
>>>My idea was...
>>> ...run the report once with the the NOCONSOLE parameter to see how many pages there are (by examining _pageno) ... Then I add a blank record to the temporary report table, and "report form ... noconsole" again and again until I finally roll over to the next _pageno, then I delete one record, and then I know my summary wil be just at the end of the last page.
>>>
>>>However, the _pageno variable does not seem to give the correct page count after the report is completed. In preview mode, the report prints about 4 lines on the second page, then prints the summary band which is about 5 lines long). But after the report runs, _pageno is equal to 1.
>>>
>>>How can I capture the real exact page count? Or, how can I get the summary band to the bottom?

>>Well, you could create a variable just before you issue the REPORT NOCONSOLE and store _PAGENO to it in a one-line UDF called from an object in the summary band. (i.e. make a report object whose expression is SavePageNo() or whatever, and SavePageNo can be Var = _PAGENO, RETURN CHR(0).)
>>
>>But someone else will probably have a "slicker" solution.
>>
>>HTH,
>>Rich.
>>

>Now I've re-read your post and I'm a bit confused. Always print on the last page is exactly what the summary band does. Is your problem that you don't want it to creep up if there aren't enough records to put it at the bottom?
>
>Darn. I was all set to say "try setting all the objects in it to [ ] Fix relative to bottom of page". But that option is disabled for items in the summary band, for some reason. And there's no option for "Put it at the bottom of the page" in the report's Title/Summary dialog.
>I'd swear there was a box to check for this in 2.x Report Writer. Where'd it go?
>
>Sorry,
>Rich.
>

Hi,

I unsuccesfully tried to achieve that some time ago. Anyway, here are some hints that may be usefull.

Instead of adding more records until the page count is one higher, remember the line number (_LINENO) after printing a detail band or the summary band (as described by Rich). After the first run, you then know the position of the last data on the page, and can calculate the number of records to add to get the summary band on the bottom of the page.

One tricky thing with all this : what if the last record fits on the page, but the summary band doesn't ?

If your report contains groep headers etc. of different height, it may be impossible to put the summary band exactly at the desired location by adding records, because the detail band has a (more or less) fixed length.

To create a band with a variable height, you can put a memo field in it, with a variable as data source. Allow the memo field and the band to stretch. Then put a certain number of RETURNs in the variable, thus changing the height. By taking a small font pitch, this can me made pretty accurate.

My best guess for solving the problem :

Include a memo field (as the one mentioned) in the top of the summary band. Set all objects to move down when the memo field stretches. Run the report once, and look for the position of the last line. Based on this, calculate the number of RETURNs to put in the memo field, put them in the variable, and print the report.

Hope this helps...

By the way, I had some problems with using the summary band : sometimes the page footer didn't print on the last page. I solved this by using a group footer instead, grouping all the records.

Marc
Previous
Reply
Map
View

Click here to load this message in the networking platform