Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Persistent variables in BIRT scripts
Persistent variables in BIRT scripts [message #1006487] Thu, 31 January 2013 13:36 Go to next message
donino donino is currently offline donino doninoFriend
Messages: 183
Registered: July 2011
Senior Member
Hi,

I am not sure how to use correctly vars[]: with BIRT 4.2.1, i noticed when we create a new var in the "Variables" section, if we set it with some "onCreate" script:

vars["myVar"]="myValue"


Then in a "onRender" script, vars["myVar"] will not be defined, it does not look persistent. But if we set it like this in "onCreate":

reportContext.setPersistentGlobalVariable("myVar","myValue");


This time, in a "onRender" script, vars["myVar"] is equals to "myValue".

Since it is more friendly to drag and drop "myVar" from Variables section than writing reportContext.getPersistentGlobalVariable("myVar") in a render expression, i wonder if we can rely on this behavior:

When we add a new variable in "Variables" eclipse designer section, does "setPersistentGlobalVariable" refer to this variable, or is it just a side-effect (may be a bug) which could change in a future version?

Thanks!


[Updated on: Thu, 31 January 2013 13:38]

Report message to a moderator

Re: Persistent variables in BIRT scripts [message #1006537 is a reply to message #1006487] Thu, 31 January 2013 15:41 Go to previous messageGo to next message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1925
Registered: July 2009
Senior Member

I don't see the same issue recalling the vars["myVar"] if you set it like: vars["myVar"] = "myValue". Can you create a sample design showing the issue that I can run?

Michael

Developer Evangelist, Silanis
Re: Persistent variables in BIRT scripts [message #1006973 is a reply to message #1006537] Sun, 03 February 2013 11:43 Go to previous messageGo to next message
donino donino is currently offline donino doninoFriend
Messages: 183
Registered: July 2011
Senior Member
Thank for your response Michael.

mmh your are right, finally i can't reproduce this issue neither Confused I probably drunk too much last week, sorry!

I did not find a tech-note or a post concerning these "Report Variables", can we rely on the fact they are persistent (can be used in a "render" event when they are initialized in a "run" event such onCreate)?

Thanks!

[Updated on: Sun, 03 February 2013 11:45]

Report message to a moderator

Re: Persistent variables in BIRT scripts [message #1007022 is a reply to message #1006973] Mon, 04 February 2013 06:00 Go to previous message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1925
Registered: July 2009
Senior Member

Ha ha. That's quite alright! Yes, there should be no issues using report variables across events. Report and Page variables were introduced back in 2.5. Here is a look at the new and notable, from then.

New and Notable - BIRT 2.5


Michael

Developer Evangelist, Silanis
Previous Topic:How to localize currency symbols in BIRT in the web application?
Next Topic:How to get the report "Layout preference" with engine API
Goto Forum:
  


Current Time: Thu Apr 18 05:55:50 GMT 2024

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

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

Back to the top