Additional EGL report handler functions

EGL has several ReportLib functions that increase the power of the report handler. The JasperReport design file can invoke an additional predefined Java™ method, getDataSource().

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

You can invoke any of the ReportLib functions in the following sections from within the report handler. Invoke getDataSource(), which is not a ReportLib function, from the XML design file source.

Function for getting report parameters

Function Purpose
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

These functions give you access at run time to variables that the report uses.

Function Purpose
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

Function Purpose
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 report handler first saves the information using addReportData(). The JasperReports engine can retrieve this data by means of getDataSource(), which is described later in this topic. To retrieve previously saved data within the report handler, use the equivalent function getReportData().

Function Purpose
addReportData (rd ReportData in, dataID String in) Associates data (as stored in a variable of type ReportData) 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 will pass to a subreport, call the getDataSource() method of the EGL report library 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 report 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 how to use the functions described in this topic, see Creating an EGL report handler.

Feedback
(C) Copyright IBM Corporation 2000, 2005. All Rights Reserved.