Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Code Reusability Questions
richardc
Hi,
There are two areas with BIRT reports code reusability that I am trying to resolve:
(1) Script Reusability
I have around 20 report templates which use similar event scripts (particularly the initialize event) - so far I have had to copy and paste the same script code for the initialize event into each report.
I am interested in including code particularly from the initialize event script in a library file if possible. I noticed it's possible to create an element in the library (for example a text field) and then create a script for that element. However, for my case, is it possible to create a script in the library (such as the initialize event) which isn't linked with any elements in the layout?
(In the initialize event script, I include all import statements, function declarations and also initializations of variables).
(2) Subreports
I have several reports which include the same subreport, so I have to copy and paste the same code for the subreport into each report template.
Also, I have a report which has around 20 subreports and because they are all in the same template, there are over 14000 lines of xml!
Is there any way to put the subreport code into a separate template file for each subreport which could then be referenced in the main report? (i.e. something like the approach taken by Jasper Reports?)
Regards,
Richard
Find more posts tagged with
Comments
richardc
Hi Michael,
Any feedback on this one?
Cheers,
Richard
johnw
My recommendations:
1: No, not in a library for the Initialize event. However, thats just with Javascript. If you want reusability of the initialize event, create a Java event handler class, and use that in your reports. That should take care of what you want. The only drawback is that you will need to deploy the JAR file in your deployment environment. File an enhancement request in Bugzilla to allow scripts for the Body elements Initialize event.
2: Is there any reason the sub-report element couldnt be put into a library?
John