
Binding a link to a label
You can make the labels in a report linked with locations specified by URLs, e-mail addresses or other reports.
To bind a link to a label:
- Right-click the label and click Link on the shortcut menu to display the Insert Link dialog.
- Select the target to which the lablel will be linked by checking the corresponding link type: Link to Report, Master/Detail Report, Link to URL or Link to E-mail.
- Specify the options for the link target.
- When done, click OK to create the link.
When a link is created, you can further edit it or remove it if you want.
- To edit an existing link on a label, right-click the label and select Edit Link from the shortcut menu. Then in the Edit Link dialog, redefine the link.
- To remove a link from a lable, right-click the label and select Remove Link from the shortcut menu.
Linking to a URL
- In the Insert Link dialog, select Link to URL as the link type. See the dialog.
- Enter the URL in the Hyperlink text box, and then specify the frame from the Target drop-down list.
The Target property works when the link is triggered in JReport Viewer and Studio. If the link is triggered in dashboards, except for Same Frame, all the other targets are treated as New Window.
For page reports, you can also click the formula button
next to the Hyperlink text box to select a field which contains URL information or create a formula to represent a URL to set the hyperlink.
- When done, click OK to set up the link.
Then, when the report containing the label runs in JReport Viewer, JReport Studio or JDashboard, or in HTML, PDF, or Excel format, you can click the label to open the URL.
If you want to further edit the link, right-click the label and select Edit Link from the shortcut menu. Then in the Edit Link dialog, define the URL
Linking to an e-mail
- In the Insert Link dialog, select Link to E-mail as the link type. See the dialog.
- For page reports, you can use the text boxes and drop-down list to compose the e-mail address. For example, a field "Company" contains company names, you can input person name in the first text box, select "Company" from the drop-down list, and input ".com" in the second text box. With this, you can click the label at runtime so as to write an e-mail to the corresponding recipient. You can also type "person@company.com" into the first text box and leave the drop-down list and the second text box empty, and thus clicking the label (or any field value) will write an e-mail to the specific address.
For web reports or library components, enter the e-mail address in the text box directly.
- When done, click OK to set up the link.
Then, when the report containing the label runs in JReport Viewer, JReport Studio or JDashboard, or in HTML, PDF, or Excel format, you can click the label to open the e-mail address.
Linking to another report
In most cases, your reports are affiliated with one another, with each report emphasizing one or more aspects of a bigger picture. Relationships can be set up in order for users to browse from one report to another through the relationship "channels" created. You can achieve an inter-report relationship network by setting up the link conditions between two reports in the same catalog. Then, when you view the primary report at runtime, you can gain access to the linked report by clicking a trigger, which is an object defined in the primary report to load a linked report.
Usually, you can use a label, a field (DBField, summary, formula, parameter, or special field), or an image as a trigger object.
To make a label linked to another report:
- In the primary report, select the label to be the trigger for loading the linked report.
- Right-click the label and click Link on the shortcut menu to open the Insert Link dialog. See the dialog.
- Make sure Link to Report is selected as the link type.
- If the primary report is a page report, click the Browse button next to the Report text field to specify the page report in the same catalog that contains the report tab you want as the linked report. Then, select the report tab name from the Report Tab drop-down list.
If the primary report is a web report or a library component, click the Browse button to specify the web report in the same catalog that you want as the linked report.
- From the Target drop-down list, select where the linked report will be loaded. The Target property works when the link is triggered in JReport Viewer and Studio. If the link is triggered in dashboards, except for Same Frame, all the other targets are treated as New Window.
- Click the Advanced button to display the advanced link settings.
- In the Conditions tab, click the add button
above the Components box. In the Choose Component dialog, add the components in the linked report you want to be interlinked with the primary report with conditions. If the required components use different datasets, you need to add them respectively, however, as long as the components are based on the same dataset, you can add them all at a time.
- Select a component from the Components box, then specify the link condition between the primary report and the linked report as follows:
- Click
above the Field Conditions box, then a new link condition line will be displayed.
- Select the desired field from the Fields(Primary) drop-down list.
- Choose an operator from the drop-down list in the OP column.
- Specify the field/formula of the linked report from the drop-down list in the Fields(LinkedReport) column. All fields in the linked report of the same value type as the selected primary report field will be available.
- If necessary, you can specify other link conditions by specifying the primary report field, the operator, and the corresponding field in the linked report. Note that the relationship among these link conditions is AND, which means that JReport will fetch linked report data which meets all of the conditions.
- Select another component from the Components box and repeat the above steps to set its link condition with the primary report.
- From the Default Linked Component drop-down list, select which component in the linked report will be linked with the primary report by default.
- If the linked report contains one or more parameters, the Parameters tab will be enabled. In this tab, you can assign field of the primary report to parameter of the linked report. Then, when running the linked report from the link, the field value of the primary report will be assigned to the parameter automatically.
- Check Pass style group information down to the linked report to transfer style information from the primary report to the linked report, so that the style of the primary report will apply to the linked report.
- Click OK to apply the settings.
Then, when the primary report runs in JReport Viewer, JReport Studio or JDashboard, when you click the label in the primary report, you will find that the linked report is displayed according to the specified link conditions. You can also trigger the link in the HTML, PDF or Excel results if you check the Run Linked Report option in the corresponding format's property setting dialog.
See also Insert Link dialog for additional information about options in the dialog.
Notes:
- A page report can only be linked with another page report, and a web report with another web report. For a library component, it can only be linked with a web report.
- When linking reports, you need to avoid link loops. For example, if you have linked report A to report B, then you cannot link report B back to report A again.
- The conditions specified in the Condition tab are used for setting up the searching criteria between the two linked reports, which means after you click the trigger object in the primary report, the pages containing the data that meet the conditions in the linked report will be displayed. However, when running the primary report in DHTML format, in JReport Studio or JDashboard, the conditions are used for filtering, that is, only the data that meet the conditions in the linked report will be displayed.
Linking to a detail report
Reports in the same catalog can be joined together in order to create a master/detail report group. Usually, the master report holds comprehensive data, while the detail reports hold related detailed information. A detail report can also be the master report of another report. In this way, you can set up more pairs of master/detail reports, where many reports are joined together, eventually leading to the formation of a report chain. Then, when you view the master report at runtime, you can gain access to the detail report by clicking a trigger, which is an object defined in the master report to load a detail report. However, in a master/detail report group, crosstab reports cannot be used as the master.
Usually, you can use a label, a field (DBField, summary, formula, parameter, or special field), or an image as a trigger object.
Master/detail report is supported on page report only at present.
To make a label linked to a detail report:
- In the master report, select the label to be the trigger for loading the detail report.
- Right-click the label and click Link on the shortcut menu to open the Insert Link dialog. See the dialog.
- Select Master/Detail Report as the link type.
- Click the Browse button next to the Report text field to specify the report in the same catalog which contains the report tab you want for the detail report, and then select the report tab name from the Report Tab drop-down list.
- Click the Browse button beside the Component field. In the Choose Component dialog, specify which component in the detail report you want to be interlinked with the master report with conditions. You can select more than one component as long as the components are based on the same dataset.
- From the Target drop-down list, select where the detail report will be loaded.
- Specify the join relationship between the master report and detail report in the Anchor section. The join can only have one condition. For example, the join can be: (Detail Report) Product ID = (Master Report) Product ID. The join condition should be as:
(Detail RPT) expression1 operator (Master RPT) expresion2
To make the join more meaningful, expression1 should be a column or record level formula in the GROUP section of a component in the detail report; and expression2 should be a column or record level formula in the DETAIL section of a component in the master report. This is because generally the master report is used to present comprehensive data, and the detail report to present more detailed information. To specify the join condition,
- Select a field/formula from the Column in Detail Report drop-down list. If this list does not offer the required field/formula, then you will need to specify the component with the data source that contains the specific field/formula. To do this, specify the component by clicking the Browse button besides the Component field.
- Choose the operator from the Operator drop-down list. The operator can be "=", "<", ">", "<>", "<=", or ">=".
- Specify the field/formula of the master report from the Column in Master Report drop-down list. This field/formula should be of the same data type as the selected field/formula of the detail report.
- Click the Advanced button to display the advanced link settings.
- In the Conditions tab, specify the filter condition between the master report and the detail report.
- Click the add button
above the Field Conditions box, then a new link condition line will be displayed.
- Select the desired field of the master report from the Fields(MasterReport) drop-down list.
- Choose an operator from the drop-down list in the OP column. The operator can be "=", "<>", "<", ">", "<="or ">=".
- Specify the field/formula of the detail report from the drop-down list in the Fields(DetailReport) column. All fields in the detail report of the same value type as the selected primary report field will be available.
- If necessary, you can specify other link conditions by specifying the master report field, the operator, and the corresponding field in the detail report. You can use the More column to specify the relationship between conditions to be AND or OR.
- If there is at least one parameter applied in the filters of the queries that the detail report uses, the Parameters tab will be enabled. In this tab, you can assign field of the master report to parameter of the detail report. Then, when running the detail report from the link, the field value of the master report will be assigned to the parameter automatically.
- If both reports use the same encoding and DB settings, you should check the option Use the same encoding and DB settings for the detail report as that of the master report. If this option is not checked, when the detail report is triggered at runtime, you will be prompted to specify the encoding and DB settings for the detail report.
- Click OK to confirm.
After a set of master/detail reports have been defined in JReport Designer and published to JReport Server, they can be viewed in JReport Viewer. The detail report supports all the DHTML operations, such as sort, filter, drill, and search.
See also Insert Link dialog for additional information about options in the dialog.
Notes:
- The join and filter conditions work together. If you want to set a single condition, you can use join (anchor). If you want to set a group of conditions, you can use the filter conditions together with a join condition. The relationship between the join and filter conditions is "Join condition AND (filter conditions)".
- If you specify to load the detail report in a new browser window, the detail report will be opened independently when you click the trigger in JReport Viewer. That is to say, the join and filter conditions you have set between the master report and detail report will not be applied.
