Custom Hyperlink Handler in Jasper Reports Server

Posted on by By Sayali Mahale, in Business Intelligence, Jaspersoft, Open Source Business Intelligence | 0

Use custom hyperlink handler with a Dashboard in JasperReports Server

Used jasper server version : 6.3.0

Problem Statement: Add hyperlink control for particular dashlet which will open drill-down in same dashboard page instead of opening drill-down report in new page.

Make data easy with Helical Insight.
Helical Insight is the world’s best open source business intelligence tool.

Grab The 30 Days Free Trail

Expected Output :

Expected output should be in one dashboard as shown below when we click on one dashlet hyperlink should open drill down report in same panel.

 

Step 1 : Click on any part of pie chart(HTML5) ie.department .
Lets assume if we click on department_id = 18 shown below :

Picture3

Step 2 : After click on department_id 18 we can see the difference it will reflect to drill down report which shows you the information related to department_id 18 and in input control automatically department_id as 18 will be selected shown below :

Picture4

If you select/click on another department_id should reflect in drill down report , you can try it.

Solution :

As mentioned above in expected output we created one dashboard having two dashlets.In it instead of passing hyperlink url we set constant value in hyperlink type as shown below :

Picture5

Or you can set it in source file(.jrxml) mentioned below :

Make data easy with Helical Insight.
Helical Insight is the world’s best open source business intelligence tool.

Lets Start 30 Days Free Trail

 

    • Create a custom hyperlink type in your main report. Here’s an example for an HTML5 chart. In this case we named it “UpdateDashboardParams”(in source code):
    • Create a new Dashboard and put all your reports on canvas shown below:

Picture6

    • Go to “Show Parameter Mapping dialog” in the Dashboard and manually create a filter (will create a section named “Manually Created Filters”) with the same name as it is produced by your custom hyperlink. In this example it is “Gender”. Then wire it to corresponding parameters in your “child” reports:

Picture7
*Property Name*

Picture8
*Show parameter mapping dialog*

    • Save the Dashboard.
    • Create a custom handler for your new hyperlink type, save it as dashboardHyperlinkHandler.js (in this case it is dashboardHyperlinkHandlerUpdateDashboardParams.js) should be same as constant value (Step 1) given for hyperlinkType otherwise it will not work.
    • Put dashboardHyperlinkHandlerUpdateDashboardParams.js to both /scripts and /optimized-scripts folders of your server deployment (.js file attached below):

dashboardHyperlinkHandlerUpdateDashboardParams.js

  • Restart jasper server and see hyperlink in dashboard.
  • Open your dashboard in Dashboard Viewer and try hyperlinks.

Here I attached the same above mentioned example using HTML5 chart, you can refer :

Custom dashboard hyperlink using HTML5 chart Example

Custom_dashboard_hyperlink_HTML5_charts

Custom dashboard hyperlink using charts-pro Example

Here , we used charts-pro pie chart in dashboard for custom hyperlink , the functionality is same just little bit of chart data configuration is different in charts-pro.

Make data easy with Helical Insight.
Helical Insight is the world’s best open source business intelligence tool.

Get your 30 Days Trail Version

 

Following are the steps to use custom hyperlink in charts-pro :

 

    • In jasper studio create new report.
    • From left side components-pro palette add charts-pro component and select pie chart.
    • Set series , categories and value expression according to you requirement under chart data.
    • Under Item Hyperlink set the constant value and its type which we previously used in HTML5 charts shown below :

Picture9

    • Set hyperlink parameters under “Hyperlink Parameters” Section.
    • Now add your dashlets in dashboard :

Picture10

    • Follow above Step 3 to set filters for drill down report shown below :

 

    • Save dashboard and follow above step 5 and step 6.
    • Restart jasper server and see hyperlink in dashboard.

 

You can see the dashboard like this :

Picture11

Please find the attachment of above example(custom hyperlink dashboard using charts-pro)

Custom_dashboard_hyperlink_charts_pro

Reference:

http://community.jaspersoft.com/wiki/how-use-custom-hyperlink-handler-dashboard-jasperreports-server

logo

Best Open Source Business Intelligence Software Helical Insight is Here

logo

A Business Intelligence Framework

Thanks,
Sayali | Helical IT Solutions

0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments