|JReport Tech Tip: Creating URL-Based Links with JHyperLink
JReport's JHyperLink feature allows you to embed a URL-based link in a report. The link can be to any valid URL, such as a web page, or even another report published to the same JReport Enterprise Server. The JHyperLink feature is a fast and powerful way to integrate reporting with your Java application.
The Report1 report, viewable at https://www.jinfonet.com/, has a set of links implemented as JHyperLink, see the "Shipper" column. Note that when you "mouse over" the column, you see a URL string in the browser preview that will pass a series of parameters to the JReport subreport.
Each of the Shipper column links brings up another report that contains the details of that shipper, for example:
To add a URL-based link, you will need to know the URL of the published report. JReport Enterprise Server provides URL command to perform different operations related to the report. Click here for information of how to construct a URL to invoke a report.
This example could also be implemented using subreports, but subreports are automatically run at the same time as the master report. With JHyperlinks, the linked report is only invoked when the hyperlink is clicked. Therefore, the master report won't incur the performance cost of running a subreport unless the end user actually requests the subreport.
For maximum flexibility, JHyperlink is implemented as a UDO (User Defined Object). Use the Insert UDO dialog (Insert > UDO) and choose JHyperLink to insert the JHyperLink UDO under the Shipper column in the report:
Then in the Report Inspector, set the URL and ExecClassName properties to invoke the Shipper Information report dynamically. Also set the displayValue properties to show the database field values in that column.
For more information about JHyperLink functionality, click here.