jmathew
17th August 2003, 10:36
Hi,
I have a requirement of including page x of y in reports generated from Baan, where x is the page number and y is total number of pages in the report. Is it possible to do this from the report script, since baan standard session script is not available in most of the cases. I have tried the solution given on this forum in report script but with no effect.
Could anybody help me out in this case!!!
Thanks,
John Mathew.
estotz
17th August 2003, 18:24
the problem with page x of y functionality is that a report is essentially a one pass execution where the sorting of the input fields is known and the total number of records is not known, nor how many lines each layout may take up until the actual output is generated.
You would essentially have to code your report so that it would calculate the number of lines each layout takes up, along with the spool device page size etc. (essentially running the report twice, once in the background).
If the report was simple, where there was only one detail line, and the same headers (and footers), calculating the number of pages from the number of records sent to the report would be easy, but every report would be a different animal (e.g. let's say you wanted to calculate how many pages a sales invoice would take - some lines have text, others not, some have tax others not).
Most of the times users will not want to forgo the extra run time required for that extra number in the report, because it is not easy functionality to deliver.
In summary, if there is a discrete mathimatical equation for number of recs vs. pages, it is easy to calculate in the program script, otherwise a major hassle having to do this in the report.
Finally .... it is very easy to report what you want as a LAST PAGE summary , but I suspect you want the x of y on every page, which does you no good.
suhas-mahajan
18th August 2003, 09:01
Hi John,
I don't think it is possible for standard sessions. We have customized our print PO & Contract, where "page X of Y" I have implemented and it is issential for such a important document. You are right following thread is not that much clear, Leena also faced same problem.
http://www.baanboard.com/baanboard/showthread.php?s=&threadid=9394&highlight=page
I am posting a piece of code for page no., this can give you only small idea.
=============================================
| Session Script
extern domain tcpono ans, totpages
long po
choice.print.data:
on.choice:
if report$ = "rtdesl940213003" then
if ans = 0 then
po = brp.open("rtdesl940213003","PO",0)
read.main.table()
ans = 1
export("ans",ans)
brp.close(po)
spool.close()
rprt_close()
po = brp.open("rtdesl940213003","W",0)
endif
endif
if rprt_open() then
read.main.table()
rprt_close()
else
choice.again()
endif
============================================
| == Main query
brp.ready(po)
rprt_send()
============================================
| Report Script
domain tcpono pageno, totpages
domain tcbool ans, firsttime
before.tdpur040.orno.1:
before.layout:
if firsttime = true then
firsttime = false
else
page()
endif
pageno = pageno + 1
totpages = totpages + 1
after.tdpur040.orno.1:
after.layout:
if ans=0 then
export("totpages",totpages)
endif
===============
If you want more info., keep in touch.
-Suhas
deepaksachdeva
27th December 2005, 12:35
Dear Suhas,
could u please paste the function page() which you have used.
With Regards
Deepak
en@frrom
27th December 2005, 13:04
Deepak,
The function page() is a standard Baan function to apply a page break...