Elements of an EGL JasperReport application

The main elements of a JasperReport application in EGL are a program to run the report and a report design file to control the layout of the report. Additionally, a report handler can give you greater control over the data put into the report.

Report design file

The report design file is an XML file with a .jrxml extension that describes how the report will look and where the data will be displayed. You can code the XML file yourself or use a third-party tool. The workbench does not provide a graphical way to create report design files.

When you have finished writing the report design file, EGL compiles it into a .jasper file, which your report driver program uses to create the report. For more information on the report design file and an example, see Creating the JasperReport design file.

Report driver program

Generally, an EGL program does the work of populating the report with data and exporting its output. The report driver program performs the following tasks:
  • Creates a Report variable to represent the report
  • Populates that report variable with a report design file and information about where the completed report will go
  • Creates a ReportData variable to represent the data in the report
  • Connects to a data source, retrieves data for the report, and puts that data into the ReportData variable
  • Calls functions in the EGL library ReportLib to run and export the report
For an example of a report driver program, see Writing code to drive a report of type JasperReport.

Report handler

The report handler is an EGL logic part that provides additional functions to be executed when the report runs. You can define a function in the report handler and then call that function from a specific place in the report design file. Also, the report automatically calls functions in the report handler at certain points during the report-creation process. For example, the report calls functions in the report handler before the report runs, after it runs and at the beginning and end of each page.

The report handler is optional. You can manipulate much of the data and the appearance of the report from the report driver program and the report design file, but you might want to use a report handler if you need to respond to events in the report.


Feedback