EGL report creation process overview

To create a report, complete the three processes described below: EGL does not require that you perform these tasks in a particular order (with the exceptions described in the "Code interrelationships between the report handler and the XML source" paragraphs in step 2 below). If you want a report handler, you can create it before you create a JasperReports design file, or you can create a report handler and the XML source for the design file simultaneously

You cannot create a report if you do not have a compiled JasperReports design file and the code for driving the report.

Use EGL ReportLib functions to write report-invocation code in your EGL project. You can use the EGL Program Part wizard when creating report-invocation code.

To create and fill a report after you create an XML source design file, a report handler (if you want to use one), and report-invocation code, you complete these steps:
  1. Build the EGL project by selecting Project > Build All.

    EGL automatically generates Java™ code from the EGL report handler (if you created one) and from the EGL report driver. (EGL compiles the XML design file into a .jasper file automatically each time you save it. You can force EGL to recompile XML design file by selecting Project > Clean.)

  2. Run the EGL program that has the report invocation code.

As the EGL program runs, the JasperReports program used by EGL first fills and stores a .jrprint file. This file uses an intermediate file format that the program will then export into the final report format (.pdf, .html, .xml, .txt, or .csv).

The JasperReports program saves the filled report in the location specified by reportDestinationFileName in the report-invocation code. The program can reuse one .jrprint file for multiple exports by pairing appropriate file locations with exportReport() functions in the report driver code. For example, the following code creates a report in .pdf format:
myReport.ReportExportFile = "C:\\temp\\my_report.pdf"; 
reportLib.exportReport(myReport, ExportFormat.pdf);

EGL does not automatically refresh exported reports. If you change the report design or if data changes, you must run the report driver again.

Related concepts
EGL reports overview

Related tasks
Creating an EGL report handler
Creating the report design file
Exporting reports
Generating files for and running a report
Using report templates
Using the EGL templates with content assist
Writing code to drive a report

Related Reference
EGL library ReportLib
EGL report handler

JasperReports design file

Create or import a JasperReports design file (extension jasper). To create the design file, put together an XML source file specifying layout information for the report. You can create this source file in one of two ways:
  • Use a third-party JasperReports design tool (like JasperAssistant or iReport).
  • Use a text editor to write Jasper XML design information into a new text file.

The XML source file should have a .jrxml extension. Be sure to save the XML design document in the same EGL package that will contain the report driver code files and the EGL report handler (if you use one).

The EGL runtime will automatically compile a valid XML source file into a JasperReports design file each time you save the source to disk (provided you have the javac compiler on your execution path). If you do not create a new .jrxml file, you must import a previously compiled .jasper file.

Report driver

Optional report handler

If you want to use a report handler, which provides the logic for handling events during the filling of the report, you can create one in either of the following ways:
  • Use the EGL report handler wizard to specify information for the report handler.
  • Create a new EGL source file and either insert a handler using the report handler template or manually enter the handler code.
Code interrelationships between the report handler and the XML source. In the .jrxml file, you can specify the scriptletClass that references the report handler file that the EGL report handler generates. Be aware of the following:
  • If the .jrxml file uses Java code that a report handler produces, you must generate the report handler before you create the .jrxml file.
  • If you change a report handler, you must recompile the .jrxml file.
  • If you need to resolve any compilation errors in the .jrxml file, you must modify the .jrxml file and save it. If you need to recompile the .jasper file after making changes to a report handler, you can force a recompile by selecting Project > Clean.
Feedback
(C) Copyright IBM Corporation 2000, 2005. All Rights Reserved.