Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
No. Page
Message
From
16/12/1998 20:56:26
 
 
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Title:
Miscellaneous
Thread ID:
00167830
Message ID:
00168346
Views:
25
>Although I haven't tried this approach yet, I think it should work under following circumstances.
>1. If your report is a typical data displayed in rows (usually are)
>2. If you know how many records there are to be printed (you should)
>3. If you know how many records you can print in each page (easy to calculate)
>
>Then you should be able to get the number of pages beforehand. To make it really tidy, you can make sure you force a page break at each # of recs interval using report variables. It might seem like a lot of work but it really shouldn't be too hard to implement. In fact, if your report is very long, this should be a lot faster than printing the report 2X just to get total number of pages.
>
>>I want to put total pages on each page of my report. How????
>>For example "page:" +STR(_pageno)+"of "+ ????????.
>>Thanks in advance



Agree, but you need to use a variable carry View if using ? in View!!
e.g.
Public myVariable
myVariable = Thisform.txtKeyField.value

* In view...
Select ... from ... where ... and MyTable.KeyField = ?myVariable

Else the system prompt will give twice on the ? ask!!

No_of_Record_Per_page need you to observe and recalculate if change Brand Height

You require will be:
"Page: " +ALLTRIM(STR(_pageno))+" of "+ ;
ALLTRIM(STR(CEILING(RECCOUNT()/No_of_Record_per_page)))

Additional Remarks!!
It will make more complex if:
i) The Cover page and Footer page worth 1 whole page
ii) There are some deleted records...

If so, you're better calculate the field before put in report use!!
Count For !delete() and MyTable.KeyField = myVariable into ActualReccount
nTotalPage = Ceiling(ActualReccount / No_of_Record_per_page)




Beyond two suggestions, print twice OR make difficult calculation!
"Print Twice" will easy to do on print twice and no need to handle additional case but it worth Double time on SQL search
Whereas "Calculation" need well documentation on maintainance and need to do more tasks and prepare, of cos fast on print!

So, using which method will depend on your case, if searching time is fast,
use "Print Twice" else "Calculation"!

For me, Currently need 1 minute for SQL search and user don't want to waste more time to wait, I use "Calculation" as most report are simply layout and easy calculate the number of totalpage!

^-^; Good Luck and Merry Xmas!!
The weak wait for chance, The strong bid for chance,
The clever notch up chance, but The merciful give you chance.
Previous
Reply
Map
View

Click here to load this message in the networking platform