How to create reports using Pentaho Report Designer
Pentaho Business Intelligence platform provides several tools to design and deploy reports, the easiest is the Pentaho BI web reporting wizard (see pentaho_reporting).
While this approach is useful for basic or self service reporting, for complex reports with charts, cross linking and scripting a tool like Pentaho Report Designer is more appropriate. Pentaho Report Designer is the reporting engine integrated in Pentaho Business Intelligence.
Other excellent Pentaho compliant reporting tools are Jasper Reports and Eclipse BIRT, however Pentaho Report Designer has the advantage of being more integrated and easily deploy-able.
Connect a database in Pentaho Report Designer
Pentaho Report Designer is an open source reporting tool available at http://sourceforge.net/projects/pentaho/files/
Once unzipped the application can be run with report-designer.bat (report-designer.sh in unix). To create a new report press File->New and then Data->Add datasource->JDBC. Pentaho Report Designer connects with several data source providers, for example SQL database, Mondrian OLAP and Pentaho Data Integration (Kettle).
In this example we’ll use a common JDBC connection for Postgres databases. To add a new connection press the plus icon on the JDBC dialog.
On the new dialog set the data base connection credentials, in this example a pre-existent Postgres database named Foodmart, with the following parameters:
Connection name: SugarBI
Connection type: Postgres
Host name: <host>
Database name: <database name>
Port number: 5432
User name: root
Password: <your password>
Access: Native (JDBC)
Now press Test to check the connection and then press ok. In case of connection error check the connection parameters and whether the JDBC driver is present in /report-designer/lib/jdbc.
Now press the plus icon and fill the SQL query text and query name, like in the following picture.
To check if the query works press Preview button and then Ok to close the dialog.
In a real enterprise application a JNDI connection would be a better solution than a direct JDBC connection. A JNDI connection, which is explained at the end of this post, defines a JDBC connection alias and avoids the hassle to update all the reports in case of database parameters changes.
Build a report with Report Designer
After the Postgresql connection configuration the Data tab (on the right) should display the connection name with all its fields. Placing a field in the report is very straight forward and can be accomplished by dragging and dropping the field on the Details band.
To set a page title click on “Ab” button in the left toolbar and drop it on Page Header band and to set a column label simply drag the “Ab” button over the Report Header band.
A page number can be added by right clicking Functions (right Data tab) and selecting Add functions..->Common->Pages of Pages. The new Pages of Pages field can then be dragged on the Page Footer.
Pentaho Report Designer allows to test the final result at any time by pressing the play icon and choosing an output format, for example PDF or HTML.
How to publish a report in Pentaho
Once built the report can be run directly on Pentaho Business Intelligence suite. Pentaho Report Designer provides direct access to Pentaho‘s repository, however the access needs to be enabled first. To enable the repository access edit biserver\pentaho-solutions\system\publisher_config.xml and set the password in the publisher-password tag:
<publisher-password>your password here</publisher-password>
The default credentials are:
Click Ok and if Pentaho server is running a form like this one should appear:
Press ok, the report should appear on the Pentaho repository browser of the Pentaho Business Intelligence suite: