Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Page Numbering on master page in a birt report
Anwar
Hi,
I want to display a page number on my BIRT report. I have done it by writing the following piece of code on onPageStart event of the master page :
importPackage(Packages.java.lang);
prev = reportContext.getPersistentGlobalVariable("previous");
if( prev == null ){
reportContext.setPageVariable("CurrentPage", 1);
reportContext.setPersistentGlobalVariable("previous", "mp1");
reportContext.setPersistentGlobalVariable("mp1cnt", new Integer(1));
}else{
if( prev == "mp1"){
var cnt = reportContext.getPersistentGlobalVariable("mp1cnt");
cnt++;
reportContext.setPersistentGlobalVariable("mp1cnt", new Integer(cnt));
reportContext.setPageVariable("CurrentPage", cnt);
}else{
reportContext.setPageVariable("CurrentPage", 1);
reportContext.setPersistentGlobalVariable("previous", "mp1");
reportContext.setPersistentGlobalVariable("mp1cnt", new Integer(1));
}
}
*****
I have initialised the page varaible to 0. But there are two problems with it -
1. If I open the report as .ppt the page valiable starts with 0. And if I open it with report viewer it starts with 1. How to synch both these outputs.
2. If the table I am loading is too long to fit in a page it goes to the next page of the report but the page no(page variable) doesn't increment in this case.
Could someone please suggest a solution to these problems.
Thanks & Regards
Anwar
Find more posts tagged with
Comments
mwilliams
Hi Anwar,
What is the reason behind doing your own page number rather than the auto text page number available in the master page palatte?
NeilKyle
pageNumber doesn't work in the Master Page and just prints out as 1 on every page. I am using 5.0.0 and for a few reasons cannot upgrade right now, but need to find a solution to this. Surely Birt is able to print the page number at the foot of every page - I would've thought that was quite mandatory for a reporting tool.
Has anyone worked out a solution to this?
Cheers
NeilKyle
When I add in the AutoText like you suggested Michael, it is working.
Thanks!
mwilliams
Hi NeilKyle,
No problem! Let us know whenever you have questions!