Localization in Pentaho Report Designer

 Localization in Pentaho Report Designer

  Localization in Pentaho Report Designer is used to change static data and parameter to dynamic content. Localization is required in reports due do different static name parameters used in different organization. For example some organizations used ‘Unit’ as center name while other organizations use ‘Center’ as name.

We can localize static data in report by two ways.

1. Storing static data in database table.

2. Localize using pentaho report designer Localization.

1. Storing static data in database table

We can use database table to store static value and retrieve such static values. Different organizations can use different static value in name/value parameters. Such name/value can be retrieved through sql query and displayed using single value query in pentaho report designer.

We can create config table in local_db database so that we can store static value and parameter. We can use name column as fixed parameter type and value can be different for different organizations. For example
In organizational 1, we can use ‘unitname’ as name column and value column can be ‘UNIT’
While in organization 2, we can use ‘unitname’ as name column and value column can be ‘CENTER’

Table Structure of Config

CREATE TABLE `local_db`.`config` (


  `name` VARCHAR(45) NULL,

  `value` VARCHAR(45) NULL,

  PRIMARY KEY (`id`));

Now In pentaho report designer, we use

1. Add Query to select single value as required and name the query as centerhomeloan’
For eg.  select value from config where name='centerhomeloan'

2. Use Open formula in pentaho report designer and add single value query as =SINGLEVALUEQUERY("'centerhomeloan' ")

3. The content from open formula can be dragged and dropped into different location of report as required.

So by using database table and pentaho report designer we can localize data in different organization. So adding different value in different organization for same name can be used to set different content in same location of reports and use of multiple reports can be minimized. 

2. Localize using pentaho report designer Localization.

By using pentaho report designer localization function, we can also localize reports. We can use pentaho report parameters like Resource Message, Resource Label, and Resource Field to localize reports dynamically. This method doesn’t require storing data to a database table and only maintain config file. We only need to create a config file with .properties extension and then select the same config file to generate dynamic content.

Following process can be used to localize the reports.

1. Open the report that is needed to be localized.

2. Go to the File menu and Select Resources.... The Resource Editor window will appear.

3. Click Create to create a new default resource bundle. A resource details window will appear.

4. Type in a file name for your resource file (using a .properties extension), and select its content type from the drop-down list. For example config.properties.

5. In the Resource Editor, select the message bundle you just created, then click Edit. A text window will appear.

6. Enter name/value pairs for all of the Resource Labels you intend to create, with the name of the label on the left and the value on the right, as shown in the example below.
centerhomeloan=Center Home Loan

7. Now Add a Resource Label, Message, or Field to report designer as required.

8. Select the element and go to attribute pane.

9 Set the value as the name that is set in config property.

10. Set resource-identifier as the name of resource file created. 

Config file can also be stored in external file as ‘config.properties’. So due to this, different organizations have particular config file as ‘config.properties’ and the name value pair parameter can be different as required.
For eg. in organization 1 , content of config.properties is
centerhomeloan=Center Home Loan

in organization 2 , content of config.properties is

centerhomeloan=Unit Home Loan

In Pentaho Report Designer, add  config.properties to the [PRD Install]/resources directory.

 For the Pentaho Webapp, put the files in the pentaho/WEB-INF/classes directory.

So by using these two methods, we can localize report in pentaho report designer and solve the problem of multiple reports requirements due to different static value in different organization.


Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation.


Post a Comment

Copyright © 2014 Online Information
Privacy Policy | Terms of Service | Site Maps | Cookie Policy
Real Time Web Analytics