Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » Change report title property value at runtime
Change report title property value at runtime [message #933588] Fri, 05 October 2012 06:29 Go to next message
j k is currently offline j k
Messages: 436
Registered: September 2012
Senior Member
Hi all,

How do I dynamically change the Title propery of my report at runtime?

I use reportContext.getReportRunnable().getProperty("title"); on my master page in my library to show my report title

It's worked fine so far because all my report titles have been constants


But I have one report now where I want a parameter value included in the report name


I've tried using

reportContext.getReportRunnable().setProperty("title") = "whatever";

and various other things but no success. The title shown when previewing the report is still the constant 'title' i've set on the General tab


And an unhandled exception error when viewing in browser

The following items have errors:


ReportDesign (id = 1):
+ Unhandled exception when executing script.

Thanks
Re: Change report title property value at runtime [message #934157 is a reply to message #933588] Fri, 05 October 2012 18:07 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

try:
reportContext.getDesignHandle().setProperty("title", "mytitle");

Jason
Re: Change report title property value at runtime [message #937448 is a reply to message #934157] Tue, 09 October 2012 01:20 Go to previous messageGo to next message
j k is currently offline j k
Messages: 436
Registered: September 2012
Senior Member
Thanks again jason,

That mostly works. The master page picks up the correct title to display, but the menu bar of the browser still shows the initial version of the title.

Is there any way to modify that as well or does that get set prior to any code on the report being executed?

Cheers
Re: Change report title property value at runtime [message #938271 is a reply to message #937448] Tue, 09 October 2012 18:24 Go to previous message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

I believe the reason this happens is because the title is read from the design by the viewer before it runs the report. The only way I know to work around this is to modify the viewer to add an id to the title tag and then add a Text element with client side script, to the report that locates the title element by this id and then use it to change on the fly.

<script>
document.getElementById("mytitle").value=<VALUE_OF>reportContext.getDesignHandle().getProperty("title");</VALUE-OF>;
</script>

Jason
Previous Topic:A BIRT exception occurred
Next Topic:Birt PDF Report: Ordered List Style Type Issue
Goto Forum:
  


Current Time: Sat Oct 25 08:53:57 GMT 2014

Powered by FUDForum. Page generated in 0.14097 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software