7.4. JasperReports

ReportServer supports the creation of graphical reports by using the OpenSource library JasperReports Library (http://www.jaspersoft.com). It is primarily designed to specify pixel perfect reports to directly print them, or to export them as a PDF at a later time. In Jasper re- ports, reports are defined in a specific XML dialect (JRXML). Reports can be directly written by using a text editor, however, in practice reports are mostly drawn up by using the open report designers IReports (http://community.jaspersoft.com/project/ireport-designer).

A JasperReport always consists of exactly one master report and one or several sub-reports. There is an XML file for the master report and for each sub-report with the extension .jrxml. These files are required to embed the report in ReportServer.

For further information on the creation of reports by using JasperReports refer to the relevant documentation of JasperSoft (http://community.jaspersoft.com/documentation).

To embed Jasper reports in ReportServer switch to the Report management and create a Jasper report in a folder. As with dynamic lists, in the following dialogue you can give a name and a description to the report as well as a unique key to call up the report by URL, for instance.

To complete the configuration you have to upload the master report (i.e. the corresponding .jrxml file) as well as all sub-reports.You can create sub-reports either by the Add sub-report button, or by dragging and dropping it to the respective window.

During report execution, sub-reports will be loaded exclusively via the subreport's name; possible path information will be ignored. Therefore, it doesn't matter how you locally organized the files belonging to a report, you need not adapt them in order to use them in ReportServer. However, you must ensure that no two sub-reports have the same name. Conversely, however, you note that ReportServer never loads sub-reports from the local server file system. Accordingly, all sub-reports always have to be registered together with the master report. Furthermore, it is not possible to share sub-reports between several reports.

Finally, you have to assign a datasource to the report. Here, you can exclusively draw from relational databases as the source of your data. In ReportServer there is no need to enter queries as you do with dynamic lists for they have already been included in the .jrxml files.

Just like dynamic lists, Jasper reports can be controlled by parameters. They will be created in the reports themselves (for detailed information refer to JasperReports/Ireport Ultimate Guides http://community.jaspersoft.com/documentation). In ReportServer you have to additionally configure all parameters entered in the report by the parameter management (tab at the bottom of the screen). Here, ReportServer will support you by automatically creating parameters from the master report. This function can be activated via the Suggest parameter button in the tool bar. We note that the automatic extraction of parameters is rudimentary and for may need manual adjustments for more complex parameter settings. The configuration of the parameters is otherwise identical to the configuration of dynamic list parameters.

7.4.1. Unformatted Excel Output

JasperReports attempts to present pixel perfect reports in all output formats.As a result, when outputting it to Excel they are usually nicely made up, however, numbers will not appear as such but as text, this complicates further data processing unnecessarily. Here, ReportServer provides the option to add an additional datasource to a Jasper report. If this function is activated you will be offered the additional output format Excel (unformatted) when executing the report. Here the ResultSet of the datasource execution will be presented as an Excel file.