### Linking a report to another report

A report can be linked to another report, after which the trigger object in the primary report can be clicked in order to jump to the linked report to obtain information about the trigger object. In JReport Designer, it is very simple to set up the link relationship between two reports.

1. Open the report set, or create a new report which will be used as the primary report.
2. In the report, select an object to be the trigger for loading the linked report.
3. In the Report Inspector, scroll down the Properties panel to find the property Link of the object, then click in the value cell to show the Link Report dialog (or right-click the trigger object, click Detail Report on the shortcut menu, then select A Report from the Link to drop-down list in the dialog). See the dialog.

4. Click the Browse button to specify the report set that contains the report you want as the linked report. Then, select the report name from the Report drop-down list.
5. Click beside the Component in Report field to specify which component(s) in the linked report will be interlinked with the primary report.
6. Specify the link relationship in the Condition tab.
   1. Select a given field/formula from the left box and click to add it to the Field box. It will then be displayed in the Fields(Primary) column.
   2. Choose an operator from the drop-down list in the OP column. The operator can be "=", "<>", "<", ">", "<=", ">=", or "IN".
   3. 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.
   4. 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.
7. If the linked report contains one or more parameters, the Parameters tab will be enabled. In this tab, you can assign field(s) of the primary report to parameter(s) of the linked report. When running the linked report from the link, the field value(s) of the primary report will be assigned to the parameter(s) automatically.
8. 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.
9. From the Target Frame drop-down list, select where the linked report will be loaded.
   - <Server Setting>
     Loads the linked report according to setting of the Pop up New Window for Links option in the DHTML tab of the Profile dialog in JReport Enterprise Server.
   - Same Frame
     Loads the linked report into the same frame as the master report.
   - Whole Window
     Loads the linked report into the full browser window.
   - New Window
     Loads the linked report into a new window. This window is not named.
   - Parent Frame
     Loads the linked report into the parent frame of the frame in which the master report is.
   - Other Frame
     Loads the linked report into some other specified frame. If the frame name does not exist, the linked report will be loaded into a new window.
10. Click OK to apply the settings.

Then, when the primary report is opened in DHTML, HTML, PDF or Excel format, when you click the trigger object in the primary report, you will find that the linked report is displayed according to the specified link conditions. However, when you open the primary report in formats other than DHTML, the Target Frame setting you specified in the Link Report dialog will be ignored.

Note:

- When linking reports, you need to avoid link loop. For example, if you have linked report A to report B, then you cannot link report B back to report A again.
- When setting up a link relationship between a crosstab and another report, no matter what object you select in the crosstab as the trigger object, the Condition and Parameters tabs are disabled in the Link Report dialog, which means the crosstab and the specified report can simply be linked, without any conditions.
- The condition specified in the Condition tab is used for setting up the searching relation between the two linked reports. That is, the page containing the data that meet the condition in the linked report will be displayed after you click the link. However, in the case when running the report with the link to the DHTML format, the condition is used for filtering. That is, only the data that meet the condition in the linked report will be displayed.