Discussions
Categories
Choose a Product
THRUST SERVICES
CORE APPS
CE PRODUCTS
...
Quick Links
POPULAR
HELPFUL TIPS
Groups
My Links
FOR SIGNED IN MEMBERS:
Back to website
Home
Designing Analytics Reports
[BIRT 2.6.2] Define global JavaScript functions in library
Migrateduser
<p>I am developing some BIRT libraries in which I would like to define some global utility JavaScript functions. The usual way to implement this is to define the JavaScript functions in a .js-file, and reference this file in the library under Properties -> Resources -> JavaScript files.</p><p> </p><p>Unfortunately in my case, the reports and libraries need to be self-contained; they get deployed to an application server where I cannot install any new or updated JavaScript files (or any other resources for that matter). As such, the JavaScript utility functions need to be defined within the libraries themselves.</p><p> </p><p>The best solution I have come up with until now is to define an invisible Grid inside my library, with the onPrepare() event handler defining all utility functions. This works quite well, except for the fact that the utility functions are not available at design time within the library.</p><p> </p><p>For example, some of my data sets have computed columns that require access to the utility functions. This works OK when generating the report, but not when using the data set Preview function. As an example, see the attached rptdesign and rptlibrary. When previewing ScriptedDataSet in the library, the values contain 'dummy' because the utility functions are not available. The report is however generated with the correct value returned by the utility function ('abc').</p><p> </p><p>Is there any better way to implement this, such that the utility functions are also available at design time?</p><p> </p><p> </p><p> </p><p> </p><p> </p>
Find more posts tagged with
Comments
There are no comments yet