Hi All, I know this is a topic which have been discussed each year, but as I’m an user who design reports for our director’s board, I want to ask some more questions about page number X of total Y. As I can see on www.mibuso.com/forum/viewtopic.php?t3769 there is a possibility to have tot total op page numbers added to a report. My question is this one : on the PostReport -which indicates for me that the report has ended- can I put there some code to retrieve the last page number ? I would think about the Quit function there followed by a decimal code called “lastpage” which will return the CurrPageNo of the last page. Maybe the Quit function is really a quitting taks, so the report will vanish from my screen, but if this is not the case, maybe there’s a way to put a hold on the page number of the last page (after guitting the report). So If i can run the report in the background (nothing is displayed on my screen) I think there’s a possibility to get the last page number in my report. Or… can I put all tables as a start of the total report BEFORE the tables which are originated in my report… just like : Customer Cust. Ledger Entry Sales Invoice Header Customer1 Cust. Ledger Entry1 Sales Invoice Header1 As above the report would at first run throught the first 3 tables, then calculate the total of pages (to print) but NOT print the records, then read tables 4,5 & 6 printing the records WITH the total op pages on each page. Can anyone please reply to these possibilities ? Thanks in advance ! Hesdo BV Arno Teurlings (Netherlands)
This definitley works when using 2 sets of data items. Use the first set (of data items) to calcuate and store the (last) page number. Use the second set to print. I have used this methods many times: it is not so elegant but it works.
Hi Hesdo, keep in mind that there are many issues that affect the page counter, so really the only way to count pages it to do a test print. You could have multiple headers or footers that only print on certain pages, group totals etc. You can’t just run through code to get the answer. It will also depend on the paper you print to. The only try way to get the number of pages is to have a report that actually prints twice, (this can be in a loop), gets the last page number, then prints again. Even if you simulate printing, data could change between runs that will give you the wrong result. I hae not yet looked at the solution on mibuso, but plan to take a look. In reality the only true solution I can see though would be for MS to create a function that prints the report and puts it in memory with a varible place holder for total pages, then reformats the report with the total pages, and then starts again but prints to paper. I think though what you really need, is to sit down with the client or your boss, or who ever, and explain this in detail to them, and maybe come up with an alternate printing solution.
Thank you David for your clear reply ![:)]
You are welcome
The simplest way is to decide how many pages you want the report to be and then print that many pages. Just start printing Page 1 of 1000, 2 of 1000, when you get to the end of the report, just print a whole bunch of blank pages to get to the total you want. If you have more than 1000 pages, then just stop when you hit 1000. [:D][:D][:D][:D]Just a thought. [:D][:D][:D][:D][:D]
[:D] best laugh of the day Chris
your link doesn’t work for me…this is it http://www.mibuso.com/forum/viewtopic.php?t=3769
I think chris can have his fourth star for this reply! Too good, … damned, I still have to work, you should post these on the break space next time. [:D][:D][:D][:D]
Hi, In your case i think print a twice or use double data item is not a good soultion because i think that’s report without print a twice could be long enough to print it, if your goal is to make sure user doesn’t loose the page for the report maybe you can try this solution. Just print the page number as usual and print the marker character (let’s say ‘LP’) on your last page with this solution user will know it if there are missing page. IF you really have to count the page you could also try Record.COUNT solution.
Aloysius that is a good solution, simple, the Navision way.