Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » Global Script functions in a library
Global Script functions in a library [message #728031] Thu, 22 September 2011 12:30 Go to next message
Mike Wulkan is currently offline Mike WulkanFriend
Messages: 141
Registered: July 2009
Senior Member
Hi,

I'm looking for a way to put a collection of useful JavaScript functions in a library such that I can keep the source in one place and link the library object into my various reports. This way I can edit the functions in one place and automatically get the changes throughout my reports. However I haven't been able to find a place or element within a library where I can put a JavaScript function and be able to access it throughout my report.

What is the best way to achieve this?

Thanks,
Mike
Re: Global Script functions in a library [message #728205 is a reply to message #728031] Thu, 22 September 2011 17:54 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Mike,

Why not just create a global.js file and put it in the resource folder.
In the report design add the global.js as a resource and the functions
in the global.js can then be used.

Jason

On 9/22/2011 8:30 AM, Mike Wulkan wrote:
> Hi,
>
> I'm looking for a way to put a collection of useful JavaScript functions
> in a library such that I can keep the source in one place and link the
> library object into my various reports. This way I can edit the
> functions in one place and automatically get the changes throughout my
> reports. However I haven't been able to find a place or element within a
> library where I can put a JavaScript function and be able to access it
> throughout my report.
>
> What is the best way to achieve this?
>
> Thanks,
> Mike
Re: Global Script functions in a library [message #730020 is a reply to message #728205] Tue, 27 September 2011 13:57 Go to previous messageGo to next message
Mike Wulkan is currently offline Mike WulkanFriend
Messages: 141
Registered: July 2009
Senior Member
This is working great. One question though, how do I reference a function from this file in a beforeGeneration chart script exit... it doesn't seem to find it directly and I can't find the magic incantation to provide the context?
Re: Global Script functions in a library [message #730098 is a reply to message #730020] Tue, 27 September 2011 15:38 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Mike,

You are correct. Can you open a bug to simplify this. There may be an
easier way, but the only one I know is: Where getMyValue is my function
in my global js.

icsc.getExternalContext().getScriptable().evaluate("getMyValue()")

Jason

On 9/27/2011 9:57 AM, Mike Wulkan wrote:
> This is working great. One question though, how do I reference a
> function from this file in a beforeGeneration chart script exit... it
> doesn't seem to find it directly and I can't find the magic incantation
> to provide the context?
Re: Global Script functions in a library [message #730108 is a reply to message #730098] Tue, 27 September 2011 16:13 Go to previous message
Mike Wulkan is currently offline Mike WulkanFriend
Messages: 141
Registered: July 2009
Senior Member
Done.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=359103
Previous Topic:XML Data-Source request method
Next Topic:How to pass parameter from HTML page to report?
Goto Forum:
  


Current Time: Thu Dec 18 15:30:27 GMT 2014

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

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