Different header on first page of Birt Report
Asked Answered
I

1

7

So there already exists this thread here which has an example that creates a different first page header than the rest of the pages. I can download this example and run it fine.

When I tried to mimic this example I couldn't do so (Clarification: After changing the source to a database of source of my own the header would not change correctly). Eventually I started to copy over individual portions of my report over to the sample one to see what triggered the issue (Clarification: I removed the differences between my report and the example one a step at a time in order to identify the exact difference which caused the issue). It ended up being my table.

For some reason that I cannot possibly explain if I add a new data set of my own, remove the table using the sample database and add a table using my data set, it won't work. When I say it won't work I mean all of a sudden the header is the same on every page and won't change for subsequent pages as expected.

If I run the debugger and put a breakpoint on the script which forces the different first and other page content (shown below) than what seems to happen is that with the sample database table, the onRender event gets called on every page... but with my table it only gets called once. That causes the master page to only check the onRender script once in the beginning, when the pageNumber variable = 1. I've been at this for hours and hours and would really like someone who might know why this is the case to help me please.

Here's the code:

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

Your help and knowledge is much appreciated,

-Asaf

Inconvenience answered 12/7, 2012 at 19:6 Comment(0)
U
3

You indicate

I tried to mimic this example I couldn't do so

so presumably you missed a step someplace. There is DevShare BIRT: Multiple Master Pages and supporting blog entry BIRT: Multiple Master Pages with no scripting that should lead you through the process.

EDIT Based on the clarification.

Modifying an existing report in BIRT (particularly the freeware version) using the 'Layout' editor may not always be correctly updated in the XML. The XML is the actual foundation for the report. Recreating the report from scratch and only using the example as a guide should solve the problem you indicate.

When you (or your client) is not completely sure what the report is going to be in the end, versioning provides a safe method for "un-doing", because in that version it never really got done. I always save a version (and document in report description) before trying something new.

Version

Unclench answered 23/4, 2013 at 16:28 Comment(5)
First of all, I apologize if my memory fails me, I asked this question quite a long time ago. So long in fact that I have switched jobs and therefore no longer use BIRT. That being said I do recall what I meant and I can see I was unclear so I after this comment I will edit and re-explain things correctly. I first wrote in the previous line "I can download this example and run it fine." So I had no problem getting the example to work as it was. Now, when I say "mimic" I mean I modified the example (used a database source of my own) and that's when the heading failed to change correctly.Inconvenience
I understand you to say you tried to modify the example you downloaded rather then create from scratch. This is a great way to lean how things are put together, but not so good for making functioning reports in BIRT. Like many applications BIRT uses a GUI to create an XML file, where the XML file is the actual 'program' and what you see on the GUI is just a representation of the XML. When you drag, drop and modify; the XML is not always correctly updated. BIRT being an open source (freeware) product this occurs more then you would expect to occur in a paid tool. (cont)Unclench
(continued) Recreating from a save point or from scratch is how I generally recover from these events, though occasionally where it is a binding error to something I deleted or renamed I will just go into the XML and make the change. When trying something new, I always do a "save as" before heading off in an untried direction.Unclench
Thank you for taking the time to attempt to answer my question. Like I said, this question was asked a long time ago, but at the time I asked it I had already written over 100 BIRT reports. I was therefore well aware that XML was behind the actual report. All the reports were also versioned in SVN and Eclipse allows you to track local history, all of which I utilized. You can see in the question that I also added a break-point and attempted to debug the issue. That being said, BIRT may have come out with new versions since... (continued in next comment)Inconvenience
(continued) Since you provided multiple links to examples and explained and since I do not have the time to actually check I'm going to accept your answer. Thank you for your help. Lastly, I recall that I "solved" this by ignoring the master page and simply adding the header to the main document. It ended up only appearing on the first page of course.Inconvenience

© 2022 - 2024 — McMap. All rights reserved.