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)
Use java event handler to code across the output of a SQL dataSet using a Scripted DataSet
chavez_ant
This example only has an example of running calculations across the DataSet derived from SQL, using a Java Event Handler. One could use similar code to run other java functions across your SQL result set and display it back into the report after such functions are run.<br />
<br />
Do the proper setup for Event handlers in BIRT. In this example, my java project had these external jars set in the classpath:<br />
<br />
org.eclipse.birt.core_2.6.1.v20100926-0604.jar<br />
org.eclipse.birt.report.engine_2.6.1.v20100926-0604.jar<br />
<br />
Create a java class with name my.event.handlers.ScriptedDataSourceFromSQL_AR. Source for ScriptedDataSourceFromSQL_AR.java is included<br />
<br />
Open the rptdesign file and note the SQL dataset's open, onFetch and beforeOpen methods, which create a 2d ArrayList and populate a global variable with the data from the sql<br />
<br />
The java event handler in the scripted dataset then takes the data and reads it, and runs calculations across it. Note that I assigned another global variable as a multiplier in the initialize method of the report, for use in the calculations in the java event handler. This is to show you can pass other parameters into the event handler from elsewhere in the report.
Find more posts tagged with
Comments
There are no comments yet