Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » how to set a global variable(i have declared a global variable but i cant access its value )
how to set a global variable [message #1033215] Thu, 04 April 2013 01:27 Go to next message
kabil Mising name is currently offline kabil Mising name
Messages: 18
Registered: August 2011
Location: India
Junior Member
Hi All,

* In initialize method i declared " reportContext.setPersistentGlobalVariable("i",new java.lang.Integer(0)); "
* I have incremented the value of " i " in On create method of 'Table detail Row'
* In Before Render method of a report i am calling the value of " i ". But the value is not incremented. Y it so...

But when i am accessing the value of " i " within table means i am getting its value.

My target is if the number of counts of a table row is '0' then i don't want to save the report document to my local disk else i have to save the document.

Please find the report in attachment.

--kabil
Re: how to set a global variable [message #1033851 is a reply to message #1033215] Thu, 04 April 2013 18:12 Go to previous messageGo to next message
donino donino is currently offline donino donino
Messages: 162
Registered: July 2011
Senior Member
hi,

The "Initialize" method is not a good place to define a persistent variable, because this event is fired twice: a first time when generating the document, and a second time on render. This is why your variable is correct when iterating within the table, and is reinitialized in beforeRender event.

You could declare a report variable and set its default value to 0 instead. See your example updated

Re: how to set a global variable [message #1034181 is a reply to message #1033851] Fri, 05 April 2013 05:29 Go to previous message
kabil Mising name is currently offline kabil Mising name
Messages: 18
Registered: August 2011
Location: India
Junior Member
Thanks for your explanation.I got the point.

Thanks lot Donino:)

--kabil
Previous Topic:Images as chart axis labels
Next Topic:Trouble Deploying on Tomcat 6 on CentOS (XML parsing error Exception)
Goto Forum:
  


Current Time: Tue Sep 30 18:12:55 GMT 2014

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

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