Additional JasperReport handler functions

When you add the JasperReport stereotype to a Handler part, you automatically make a number of implicit EGL functions available. Additionally, the JasperReports design file can invoke the getDataSource() internal Java™ method.

JasperReports distinguishes between three types of entities that the report engine evaluates at run time:

You can call any of the implicit functions in the following sections from within the JasperReport handler. Invoke getDataSource(), which is an internal EGL Java method, from the XML design file source.

Function for getting report parameters

Function Description
getReportParameter (parameter STRING in) Returns the value of the specified parameter from the report that is being filled. The returned value is of type ANY.

Functions for setting and getting report variables

You can use the following functions at run time to access variables that the report uses.

Function Description
getReportVariableValue (variable STRING in) Returns the value of the specified variable from the report that is being filled. The returned value is of type ANY.
setReportVariableValue (variable STRING in, value Any in) Assigns the value to the specified variable.

Function for getting field values

You can use the following function to access current fields in the report.

Function Description
getFieldValue (fieldName STRING in) Returns the value of the specified field value for the row currently being processed. The returned value is of type ANY.

Functions for storing or retrieving data for subreports

A subreport is a report that you call from within another report. To pass report data to a subreport, the JasperReport handler first saves the information using addReportData(). The JasperReports engine can retrieve this data by means of getDataSource(); see "Java methods available to the report design file" in this topic. To retrieve previously saved data within the JasperReport handler, use the equivalent getReportData() function.

Function Purpose
addReportData (rd ReportData in, dataID String in) Associates data (as stored in a ReportData variable) with the name dataID.
getReportData (dataID String in) Retrieves data that you previously stored under dataID using addReportData(). getReportData() returns a value of type ReportData.

Java methods available to the report design file

To access data that you pass to a subreport, call the getDataSource() function from your XML report design file.

Function Purpose
getDataSource (dataID STRING in)

Within a report design file, retrieves data that you previously stored under dataID when you invoked addReportData() in the JasperReport handler.

getDataSource() returns the data in an internal format. You must cast the return value as a JRDataSource for the subreport to be able to use that data.

For examples showing how to use the functions described in this topic, refer to the EGL Programmer's Guide.


Feedback