04. Integrating Pentaho Reports (JFreeReports)

Unknown macro: {scrollbar}

For a more documentation on using JFreeReport with the Pentaho Platform please see Report Design Wizard

JFreeReport Report Definitions

JFreeReport report definitions are XML documents typically with a .xml extension, although this is not necessary. The Pentaho JFreeReportComponent (org.pentaho.plugin.jfree.JFReeReportComponent) uses the report definitions along with your data to produce a comprehensive set of output formats. The JFreeReport output formats worth noting are HTML, PDF, CSV, XLS and RTF.

JFreeReport gets its data from a Java TableModel. There is a custom TableModel implementation in the Pentaho Platform which provides for a memory friendly and performance efficient operation. Since JFreeReport operates against a definition and a TableModel there is no way to parameterize the JFreeReport itself. This is accomplished in the action-sequence and in the query itself.

Using the Pentaho Report Design Wizard you can create a JFreeReport definition and a basic action sequence. In the most simple case create a report against a <Blank> template and enter a SQL query against your database.

The screenshot above shows a parameterized SQL query for use with the Report Design Wizard. The column 'REGION' is what we are using for our parameter. The name of the parameter is also 'REGION' but this is not necessary. The wizard does not currently have the ability to prompt the user for parameter values, so a default value of 'Eastern' has been supplied. The full parameter is specified as {REGION=Eastern} in the query.

When the report is previewed in the Report Design Wizard the REGION parameter value is replaced with the specified default value (Eastern). When the report is published for use in the Pentaho platform the REGION parameter is setup in the action-sequence and the user will be prompted to enter a value. The action-sequence generated by the Report Design Wizard can be further customized by the Pentaho Design Studio.

Creating the Action Sequence

Once you have verified that the report works in the Report Design Wizard you can rest assured that it will work in the Pentaho Platform. The reason for this is that the Report Design Wizard runs the report in an embedded standalone version of the Pentaho Platform. There is no need to create an action-sequence since once is generated automatically by the wizard. However, should you have an existing JFreeReport definition that was created by hand or from another tool. To see an example of an action sequence that generates a JFree report using report parameters refer to pentaho_demo/pentaho_solutions/samples/bursting/BurstActionSequence.xaction. Select the Define Process tab and select the JFree Report action in the Process actions tree.

JDBC Driver Setup

If you are using a database driver other than Hypersonic you'll need to configure the JBoss PCI to use that driver.

TODO

add the JDBC setup. We should have an generic JDBC setup doc that the components all like to

Verifying JFreeReport Integration into Pentaho Platform

At this point the report should be plugged in and ready for use. Point your web browser to your PCI (typically http://localhost:8080). Navigate to the report that you created under the Reporting Examples group.

When you hit the URL for the report a default parameter page is generated prompting you for an input to the parameter for REGION.

Once you submit the parameter the report will be generated and depending on the output-type in the action-sequence you'll see your report in the format desired. The example above shows an HTML screenshot.

The Report Design Wizard

The Pentaho Report Design Wizard provides for quick and easy creation of JFree reports using a simple step-by-step process, that allows for editing of the most commonly used report formatting features. The design wizard is the easiest way to quickly develop customized JFree reports. The wizard is available both as a stand alone application as well as an editor built into the Pentaho Design Studio. For a detailed description of how to use the wizard refer to the Report Design Wizard User's Guide.

Creating a Design Wizard Specification

Select the Pentaho Design Studio icon and choose "New JFree Report Wizard File". Then select the Container Browse button, and choose the "reporting" folder in the PCI then select OK. Now give your new action sequence a name. You're now ready to design your report. If you're new to the Report Design Wizard, you can work through the example in the Report Design Wizard User's Guide. You'll want to skip the step titled "Deploying Reports into Pentaho BI Platform". When your design is complete make sure to save your new report specification.

Using a Design Wizard Specification

Once you've designed your report wizard specification it's time to integrate it into an action sequence that will allow it to run as part of the installed solution. Using the same process we described earlier, create a new blank action sequence in the "reporting" directory of your solution. Assign title, icon, and brief description to your new action sequence to assist you in finding it when we test our action sequence. Select the define process tab then right-click in the Process Actions tree area and select Add->Report->JFree Report. Now select the Browse link on the right side of the page. In the file chooser dialog select the Report Wizard Spec (*.xreportspec) file type then select the wizard specification you created above and select Open. Now save your new action sequence and your ready to go. It's that simple. Use your favorite browser and go to the reporting examples within the PCI. You should see a new entry for the new action sequence you've created. Go ahead and select it and your report should display.

Unknown macro: {scrollbar}