How to use parameters in Pentaho reports

Pentaho reports can be filtered by using parameters.

Pentaho report parameters


This task can be accomplished in Pentaho Report Designer. For more informations about Pentaho Report Designer and how to publish a report in Pentaho read how_to_use_pentaho_report_designer_tutorial.

Create a parametrized report

For example open an existing report created with Pentaho Report Designer and in the Data palette right click on Parameters -> Add Parameter.

Pentaho report add parameters

Here you can define the parameter name, display format, display type (lists, date pickers, text values), etc. 

The query parameter, optional for some display types, is required in the case of prefilled list of values (for example Drop Down). This query is a common Report Designer Data Source object, that can be defined in the classic way (Data -> Add datasource..), and will be used during run time filling the parameter values.

In this example we used StoreList, a Report Designer datasource defined as follow:

select store_id, store_name from stores_lists;

The new parameter should appear in Data palette, like in the picture.

How to add parameters in Pentaho Report Designer

This parameter can be injected in the main query with the keyword ${parameter name}, as in the following picture:

Example add parameters in Pentaho Report Designer

The Store parameter will be prompted at run time during report execution and its value will replace the ${store} keywork in query text.

To test the new report in Report Designer click Run button. As you can see the Store parameter is populated and the resulting report will be filtered with the selected value.

How to use parameters in Pentaho

Deploying a parametrized report on Pentaho

A report designed with Pentaho Report Designer can be published on Pentaho Business Intelligence Suite by clicking File -> Publish..

For more informations read how_to_use_pentaho_report_designer_tutorial. Make sure the Pentaho publish password is defined, as in pentaho_publish_password_how_to, otherwise the publish process will fail.

Example report publish parameter

Once the report has been published in Pentaho Business Intelligence Suite the parameter will be prompted on report execution, which allows the final user to filter the data.

Example run report publish parameter on Pentaho Business Intelligence Suite