Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » Page headers depending upon the page number
Page headers depending upon the page number [message #714349] Wed, 10 August 2011 07:48 Go to next message
sam va is currently offline sam va
Messages: 121
Registered: July 2011
Senior Member
Hi All

I have a report where the first page has a header and all other subsequent pages have a different header. I know we can specify master page per table. But how do we specify by page ?

Thanks everyone in advance
Re: Page headers depending upon the page number [message #714498 is a reply to message #714349] Wed, 10 August 2011 12:32 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

Currently you can not change the master page while a table is
processing. You should be able to use page variables and scripts to
alter the values that appear on a master page or use row count filtering
to add two or more tables that are the same and put them on different
master pages. For example table1 could list the first 20 customers and
table2 could list the rest. Then assign each table to a different
master page.

Jason

On 8/10/2011 7:48 AM, sam wrote:
> Hi All
>
> I have a report where the first page has a header and all other
> subsequent pages have a different header. I know we can specify master
> page per table. But how do we specify by page ?
>
> Thanks everyone in advance
Re: Page headers depending upon the page number [message #714879 is a reply to message #714498] Thu, 11 August 2011 12:40 Go to previous messageGo to next message
sam va is currently offline sam va
Messages: 121
Registered: July 2011
Senior Member
Is there a way to manipulate the visibility of the page headers.
What I mean is, I will have two grids in the header of the master page. One for the first page and second for the rest of the pages. Can I code in the visibility script of the grids such that each one will be shown appropriately. Something like below
if (pageNumber == 1)
true;
else
false;

I tried the above but doesnt seem to work.

I tried another way.

In the pageStart / pageEnd scripts of the master page, I tried the following code.
importPackage (Packages.org.eclipse.birt.report.engine.api.script.instance);

var pageHeaderGridNo;
if (pageNumber == 1) {
pageHeaderGridNo = "partialHeader";
}
else {
pageHeaderGridNo = "fullHeader";
}
var reportItem = null;
for (i = 0; i < this.getInstancesByElementName(pageHeaderGridNo).length; i++) {
reportItem = this.getInstancesByElementName(pageHeaderGridNo)[i];
reportItem.setWidth("0in");
reportItem.setHeight("0in");
}

But both of them didnt work. Basically I need one header for the first page and another header for the rest of the pages

Thanks
Re: Page headers depending upon the page number [message #714911 is a reply to message #714879] Thu, 11 August 2011 14:07 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

If you are using 3.7 you can add a grid to the master page header with
two rows. Put two new grids in each of the rows and set an onRender
script like:
//first nested grid
if( pageNumber > 1 ){
this.getStyle().display = "none";
}
//second nested grid
if( pageNumber == 1 ){
this.getStyle().display = "none";
}else{
this.getStyle().display = "block";
}


See attached example
Jason


On 8/11/2011 12:40 PM, sam wrote:
> Is there a way to manipulate the visibility of the page headers.
> What I mean is, I will have two grids in the header of the master page.
> One for the first page and second for the rest of the pages. Can I code
> in the visibility script of the grids such that each one will be shown
> appropriately. Something like below
> if (pageNumber == 1)
> true;
> else
> false;
>
> I tried the above but doesnt seem to work.
>
> I tried another way.
>
> In the pageStart / pageEnd scripts of the master page, I tried the
> following code.
> importPackage
> (Packages.org.eclipse.birt.report.engine.api.script.instance);
>
> var pageHeaderGridNo;
> if (pageNumber == 1) {
> pageHeaderGridNo = "partialHeader";
> }
> else {
> pageHeaderGridNo = "fullHeader";
> }
> var reportItem = null;
> for (i = 0; i < this.getInstancesByElementName(pageHeaderGridNo).length;
> i++) {
> reportItem = this.getInstancesByElementName(pageHeaderGridNo)[i];
> reportItem.setWidth("0in");
> reportItem.setHeight("0in");
> }
>
> But both of them didnt work. Basically I need one header for the first
> page and another header for the rest of the pages
>
> Thanks
>
Re: Page headers depending upon the page number [message #715020 is a reply to message #714911] Fri, 12 August 2011 01:53 Go to previous messageGo to next message
sam va is currently offline sam va
Messages: 121
Registered: July 2011
Senior Member
thanks a lot. It does work with 2.6.2. But there is one issue here in PDF. HTML is fine.
Lets say the first grid takes 10 inches and second grid 5 inches, the total space occupied in the output is 15 inches. But on page 1 I need the header to occupy only 10 inches and on the second page 5 inches. Is there anyway we can change the header height dynamically ?

Thanks

[Updated on: Fri, 12 August 2011 03:11]

Report message to a moderator

Re: Page headers depending upon the page number [message #715175 is a reply to message #715020] Fri, 12 August 2011 11:28 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

Yes I believe that was a bug in 2.6.2.

Jason

On 8/12/2011 1:53 AM, sam wrote:
> thanks a lot. It does work with 2.6.2 for HTML. But for PDF, it doesnt work
>
> Thanks
Re: Page headers depending upon the page number [message #720249 is a reply to message #715175] Tue, 30 August 2011 04:25 Go to previous messageGo to next message
sam va is currently offline sam va
Messages: 121
Registered: July 2011
Senior Member
I have 2 master pages (one for portrait and one for landscape).
This code (not the attachment in this forums, but the one I coded) works in portrait but doesn't work in landscape
Any clues

In HTML the code is working fine. But in PDF for the pages after first, both the grids are being shown.

Thanks

[Updated on: Tue, 30 August 2011 05:54]

Report message to a moderator

Re: Page headers depending upon the page number [message #720362 is a reply to message #720249] Tue, 30 August 2011 09:09 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

Which code? This one?

if( pageNumber > 1 ){
this.getStyle().display = "none";
}

Jason

On 8/30/2011 4:25 AM, sam wrote:
> I have 2 master pages (one for portrait and one for landscape).
> This code (not the attachment in this forums, but the one I coded) works
> in portrait but doesnt work in landscape
> Any clues
>
> Thanks
> Swamy
Re: Page headers depending upon the page number [message #720640 is a reply to message #714349] Tue, 30 August 2011 21:29 Go to previous messageGo to next message
sam va is currently offline sam va
Messages: 121
Registered: July 2011
Senior Member
yes
Re: Page headers depending upon the page number [message #720923 is a reply to message #720640] Wed, 31 August 2011 09:36 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

Can you post an example using the sample database that shows the issue?

Jason

On 8/30/2011 9:29 PM, vavesw wrote:
> yes
Re: Page headers depending upon the page number [message #721024 is a reply to message #720923] Wed, 31 August 2011 14:04 Go to previous messageGo to next message
sam va is currently offline sam va
Messages: 121
Registered: July 2011
Senior Member
Pl see the attached zip file.
Run the following reports
/ccer/resources/templates/OfflineLandscape.rpttemplate
/ccer/resources/templates/OfflinePortrait.rpttemplate

Run it in Web Viewer. HTML is fine for both the reports. But for PDF landscape, it doesnt work. Both headers show up for page numbers greater than 1.

Thanks
  • Attachment: Birt1.zip
    (Size: 11.44KB, Downloaded 104 times)
Re: Page headers depending upon the page number [message #721162 is a reply to message #721024] Thu, 01 September 2011 00:12 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

This does indeed appear to be a bug in 2.6.2. It appears to be fixed in
3.7. The events are not being fired correctly for landscape. This has
to do with pagebreak interval as set on the table. When you are in
landscape you have less room for vertical rooms so the pagebreakinterval
is never hit and the events do not fire. Set your page break interval
lower and it should work. In 3.7 this works with a pagebreakinterval of 0.

Jason


On 8/31/2011 2:04 PM, vavesw wrote:
> Pl see the attached zip file.
> Run the following reports
> /ccer/resources/templates/OfflineLandscape.rpttemplate
> /ccer/resources/templates/OfflinePortrait.rpttemplate
>
> Run it in Web Viewer. HTML is fine for both the reports. But for PDF landscape, it doesnt work. Both headers show up for page numbers greater than 1.
>
> Thanks
Re: Page headers depending upon the page number [message #721388 is a reply to message #721162] Thu, 01 September 2011 12:09 Go to previous messageGo to next message
sam va is currently offline sam va
Messages: 121
Registered: July 2011
Senior Member
Where is this page break interval property?
Re: Page headers depending upon the page number [message #721392 is a reply to message #721388] Thu, 01 September 2011 12:17 Go to previous messageGo to next message
sam va is currently offline sam va
Messages: 121
Registered: July 2011
Senior Member
Apologize. I did see that this is in the table property.
There is one issue using this property. I have some dynamic text controls and I do not know how many rows each page will occupy. Is there any other way out of this?

Thanks
Re: Page headers depending upon the page number [message #721394 is a reply to message #721388] Thu, 01 September 2011 12:14 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

It is on the table page break property. Select the table, click on page
break in the properties view and then look for page break interval.

Jason

On 9/1/2011 12:09 PM, vavesw wrote:
> Where is this page break interval property?
Re: Page headers depending upon the page number [message #721395 is a reply to message #721392] Thu, 01 September 2011 12:24 Go to previous messageGo to next message
sam va is currently offline sam va
Messages: 121
Registered: July 2011
Senior Member
Apologize. I did see that this is in the table property.
There is one issue using this property. I have some dynamic text controls and I do not know how many rows each page will occupy. Is there any other way out of this?

Thanks
Re: Page headers depending upon the page number [message #721401 is a reply to message #721392] Thu, 01 September 2011 12:21 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

In 3.7 it should be fine, but if you can not upgrade:

Does the dynamic content appear on page 1?

Jason

On 9/1/2011 12:17 PM, vavesw wrote:
> Apologize. I did see that this is in the table property.
> There is one issue using this property. I have some dynamic text
> controls and I do not know how many rows each page will occupy. Is there
> any other way out of this?
>
> Thanks
Re: Page headers depending upon the page number [message #721404 is a reply to message #721395] Thu, 01 September 2011 12:40 Go to previous messageGo to next message
sam va is currently offline sam va
Messages: 121
Registered: July 2011
Senior Member
Yes. The dynamic content can appear in any page.

I have tried another option.
For the master page (landscape), I changed Type to Custom (8.5 X 11). Still I see the issue

Thanks
Re: Page headers depending upon the page number [message #721421 is a reply to message #721404] Thu, 01 September 2011 13:49 Go to previous messageGo to next message
sam va is currently offline sam va
Messages: 121
Registered: July 2011
Senior Member
Tried another option

Moved all the controls into one grid.
In the OnRender method, set the display style to none/block appropriately. Looks like the same issue is there for landscape pdf.

Thanks
Re: Page headers depending upon the page number [message #721431 is a reply to message #721421] Thu, 01 September 2011 14:15 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

You can insert page breaks dynamically but the issue is we have no way
to get the currently generated vertical space. If you could figure out
how may lines the dynamic content is going to take, you could implement
your own page break which would fire the appropriate events.

Jason

On 9/1/2011 1:49 PM, vavesw wrote:
> Tried another option
>
> Moved all the controls into one grid.
> In the OnRender method, set the display style to none/block
> appropriately. Looks like the same issue is there for landscape pdf.
> Thanks
>
Re: Page headers depending upon the page number [message #721586 is a reply to message #721431] Fri, 02 September 2011 04:14 Go to previous messageGo to next message
sam va is currently offline sam va
Messages: 121
Registered: July 2011
Senior Member
I did test in 3.7 and seems like it is working fine. We might upgrade to 3.7.
Is there a list of all the bugs fixed in the 3.7 release. not features.

Thanks
Re: Page headers depending upon the page number [message #721690 is a reply to message #721586] Fri, 02 September 2011 11:11 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

You can query bugzilla for this:
https://bugs.eclipse.org/bugs/buglist.cgi?classification=BIRT&product=BIRT&target_milestone=3.7&target_milestone=3.7.0+M1&target_milestone=3.7.0+M2&target_milestone=3.7.0+M3&target_milestone=3.7.0+M4&target_milestone=3.7.0+M5&target_milestone=3.7.0+M6&target_milestone=3.7.0+M7&target_milestone=3.7.0+RC0&target_milestone=3.7.0+RC1&target_milestone=3.7.0+RC2&target_milestone=3.7.0+RC3&target_milestone=3.7.0+RC4

Jason

On 9/2/2011 4:14 AM, vavesw wrote:
> I did test in 3.7 and seems like it is working fine. We might upgrade to
> 3.7.
> Is there a list of all the bugs fixed in the 3.7 release. not features.
>
> Thanks
Re: Page headers depending upon the page number [message #721711 is a reply to message #721690] Fri, 02 September 2011 12:25 Go to previous message
sam va is currently offline sam va
Messages: 121
Registered: July 2011
Senior Member
thank you
Previous Topic:BIRT - Installation problems on Win64 (Indigo)
Next Topic:IReportContext
Goto Forum:
  


Current Time: Sat Aug 30 12:42:27 EDT 2014

Powered by FUDForum. Page generated in 0.02379 seconds