Getting Started
by Giulio Toffoli
Hi, and welcome to iReport. If you are reading this document, probably you never used iReport before and it might not be clear to you what iReport is or can do. If you are evaluating iReport, this document should help you to understand the basics concepts about creating reports with iReport and JasperReports. Be sure to check out the Gallery and the Features pages for a bigger overview of the iReport capabilities.
What is iReport?
There are several ways to add reporting capabilities to an application. For many web developers, to create a report just means to create a web page, which produces good results on screen but poor results when printed to paper. And to create a report in PDF means write more code... tons of code, making the reports hard to maintain and long to write. When working with other technologies the problem does not change very much. For example, Java provides an extensive API for printing, but there is still a lot of work to write specific code for each document format.
The answer to this problem is to use a reporting library. JasperReports is the world's most popular open source Java reporting library, and iReport is a visual report designer for JasperReports. The library is a report engine that can be integrated in your open or commercial application to generate the reports designed with iReport, display them on screen or export them in a final format like PDF, OpenOffice, DOCX and many others. Alternatively, you can stream the result through a web application or send the final document directly to a printer. JasperReports is in some way the core of iReport.
JasperReports is extremely easy to integrate in an Java application, but if you need an environment to use the reports without having to write a custom application, you may consider using JasperServer . JasperServer provides a web based interface to manage, schedule, and run the reports; a repository to store all the report resources like images, fonts, data sources and much more; a security service to decide who can execute which report; and a web services API to execute the reports from external applications (so you can generate reports from any kind of environment, like PHP or .NET).
In the big picture, iReport allows you to design reports, JasperReports allows to execute them and generate output in a Java application, and JasperServer allows both end users and external applications to access, view, and publish your reports securely. JasperServer also makes reports interactive by adding drill down and drill up capabilities to your documents.
Report Life Cycle
Before we start working with iReport, let's learn about the life cycle of a report. When you design a report using iReport you are creating a JRXML file, which is an XML document that contains the definition of the report layout. The layout is completely designed in a visual way, so you can ignore the real structure of the JRXML file. Before executing a report, the JRXML must be compiled in a binary object called a Jasper file. This compilation is done for performance reasons. Jasper files are what you need to ship with your application in order to run the reports.
The report execution is performed by passing a Jasper file and a data source to JasperReports. There are plenty of types of data sources, it's possible to fill a Jasper file from an SQL query, an XML file, a csv file, an HQL(Hibernate Query Language) query, a collection of JavaBeans, etc... If you don't find a suitable data source, JasperReports is very flexible and allows you to write your own custom data source. With a Jasper file and a data source, JasperReports is able to generate the final document in the format you prefer.
iReport also lets you configure data sources and use them to test your reports. In many cases, data-driven wizards can help you design your reports much quicker. iReport includes the JasperReports engine itself to let you preview your report output, test, and refine your reports.
![](http://jasperforge.org/uploads/publish/ireportwebsite/IR%20Website/images/compilation_process.png)
Figure 1
User Interface
So what does iReport look like? iReport is a powerful environment to design reports. Reports can be designed from scratch or from one of the many ready-to-use templates that are available. iReport will assist you during all the phases of the report development: JRXML design, Jasper compilation, report execution, and document export or visualization. Figure 2 shows the main user interface components of iReport.
![](http://jasperforge.org/uploads/publish/ireportwebsite/IR%20Website/images/iReport_main_ui.png)
Figure 2
The Report Designer is where you visually design the report by dragging, positioning, aligning and resizing report elements.
The Report Inspector shows the complete structure of the report which is composed of many objects (such as fields, parameters and variables), bands (which are sections of the document) and elements (such as textfields, images or charts).
The Elements Palette contains the elements that can be dragged inside a band to display your data.
The Property Sheet is used to set the properties of the currently selected component in the report (such as a field, element, band, group, or other).
![](http://jasperforge.org/uploads/publish/ireportwebsite/IR%20Website/images/datasource_and_preview_buttons.png)
Figure 3
Above the report designer there is the data source selector, which shows the active connection that will be used to execute the report (Figure 3).
The report designer toolbar has three buttons to easily switch from design to preview mode. When you click the preview button, iReport executes the report using the active connection and displays the result using an internal previewer. iReport can also be configured to automatically export the document in a particular format and open the proper viewer (such as a browser or a PDF viewer).
Now you're ready to see iReport in action by designing a report .
Have fun!