Once you have placed a report element in the workspace, it can be formatted in different ways. Pentaho Reporting Designer provides various features to format the reporting elements as per our requirement.
All the text-based elements such as text, number, date, and labels can be easily formatted using the Formatting Toolbar that appears just above the Report Canvas.
Take a look at the following screenshot. Here, we have marked and highlighted three objects −
First of all, select the Report Element on the workspace. Thereafter, you can format that element in many ways using the Formatting toolbar or using the properties from the Style Tab pane.
Pentaho Report Designer allows you to add hyperlinks to your report data. Here we will take a general example to explain how to add hyperlinks in your report.
Assume that we have already added a query in the employee table to fetch the fields’ id, name, and designation. We have also added these fields to the Reporting workspace. Here our requirement is to pass the individual values of the designation field to www.google.co.in as a parameter value using a hyperlink.
First, select the designation field in the workspace. Right click on it and select Hyperlink from the list. Take a look at the following screenshot.
After clicking the Hyperlink option, you will find a dialog box where you have to provide details such as Type of the hyperlink location, URL, Target, Parameter name, and Value.
Take a look at the following screenshot. Here we have marked and highlighted the following five activities −
Provide the type of Hyperlink Location. Generally there are four types of locations −
Self − Linking to the same report field.
URL − Provide a URL for that reference location.
Pentaho Repository − If you install Pentaho Repository, then provide that file URL in the localhost (Login is required).
Manual Link − Create a link or a formula manually and provide it as Hyperlink.
For this example, we have used URL type location.
Provide the URL of the website or the file. For this option, we have used https://www.google.co.in.
Provide the Target location, that is, _TOP, _BLANK, or _PARENT. We have used “_TOP”. If you want to provide any information to the user when the mouse pointer moves over the hyperlink text, then type the information in the tooltip box which is placed just beside the Target box.
Select the plus (+) symbol to add a Parameter name and value to the parameter list.
Provide a Parameter name and a value to the URL of the Hyperlink. Here we have used “q” as the Parameter name and Designation field as the Parameter value.
Finally, click OK to confirm the Hyperlink properties.
Click the Preview button on the formatting toolbar to see a preview of the report. After clicking the Preview button, you will find the following screenshot. Place the mouse pointer on any designation value – either HR or Admin – to see its respective URL.
In this Pentaho Report Designer preview, the hyperlink is meant for redirecting the user to another URL. For that, you have to run this report on HTML by clicking the Run button on the Main toolbar (marked as "1" in the following screenshot) and select the HTML option on it.
Take a look at the following screenshot. There are different options for running the report, but we have chosen to display the report in HTML format.
After selecting the HTML option, you will find the report data in a separate HTML page, as shown in the following screenshot. Click on any Designation value to understand how a hyperlink works in Pentaho Reporting.
Pentaho Report Designer has a row banding property that allows you to color the alternate rows of your report. Let us take our previous example to understand how it works.
After adding the elements into the workspace, click the report workspace → go to the Format menu → select Row Banding. Take a look at the following screenshot.
After selecting the Row Banding option, you will find a dialog box. Here, you can select a color from the dropdown list. We have selected red and green as the alternate colors. Now, click the OK button to confirm. Take a look at the following screenshot.
Click the Preview button to see how your report appears with alternate row colors. It will appear as shown in the following screenshot.