iReport plugin for JasperServer If you have solved an issue of reporting, you have probably found and used or at least investigated the JasperReports. This framework offers flexible template tool based on defined XML format, which you design using WYSIWYG graphical editor iReport from the same vendor. Various output formats are available – PDF and XLS are the most interesting ones.

Last week I was working on some reports with data in Oracle database. It was very helpful that we have a JasperServer installed - it servers for hosting, management, scheduling of the reports, and managing the generated reports. The iReport editor contains a pre-installed plugin for server management. It requires only location and credentials to logon, will load content into the editor widget and you can manipulate anything from the server content, or edit the templates directly in the editor. My issue was a bit complicated because there were input parameters required, e.g. select an invoice state or restrict the time interval. I was searching some solution for a day or longer, so I am going to describe, how to create a resusable input control components with value options loaded from database at JasperServer.

You must have input parameters defined in the report template. The input control name must be equal to the name of the input parameter! If you have completed the report template, you can define input controls. To fill the component with data, you need a Query. After right click at a folder in JS-plugin select Add > Query. General tab requires to fill Name (the component ID) and Label (component label name). At the Query tab you define source to obtain data. You have to select the query language (e.q. SQL, EJBQL, HQL or XPath), select one of defined data connections (e.q. to database) and define the query.

Having the Query created, you can create an input control. Use Add > Input Control dialog; one of the attributes worth mentioning is Type, which you should set to Single Select Query, then find the query at the JasperServeru. Value Column defines value column name. Visible Query Columns defines columns, which will appear visible in the select input control.

After you have all necessary components created, open the Report Unit structure, and link each of them via right-click and Link an Existing Input Control. Now you have complete report, select input controls with right value options and after selecting them a report is generated.

In Czech / Ĩesky

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed

This blog copyright 2009 by Josef Petrak