
Linking a report 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 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.
To link a report to a detail report, that is to set up a master/detail relationship between two reports,
- In JReport Designer, open the report set which contains the report that you want to use as the master report.
- Select an object to be the trigger for loading the detail report.
- In the Report Inspector, scroll down the Properties panel to find the property Detail Report of the object, then click
in the value cell to bring out the Master/Detail Report dialog (or right-click the trigger object and click Detail Report on the shortcut menu). See the dialog.
- Click the Browse button to specify the report set which contains the report you want for the detail report, and then select the report name from the Report drop-down list.
- Click
beside the Component in Report field to specify which component(s) in the detail report will be interlinked with the master report.
- Specify the join relationship in the Anchor tab. The join between the master and detail report 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 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, select the component from the Component in Report drop-down list.
- 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 drop-down list. This field/formula should be of the same data type as the selected field/formula of the detail report.
- If you want to filter the detail report data, switch to the Filter tab to specify the conditions.
This tab is very similar to the Condition tab in the Link Report dialog. You can refer to the procedure in Linking a report to another report for details. The only difference is that with the Field box in the Filter tab here, there is an extra column More, with which you can specify the relationship between filter conditions to be AND or OR.
Note: The join and filter condition(s) 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 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(s) of the master report to parameter(s) of the detail report. When running the detail report from the link, the field value(s) of the master report will be assigned to the parameter(s) 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.
- From the Target Frame drop-down list, select where the detail report will be loaded.
- <Server Setting>
Loads the detail 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 detail report into the same frame as the master report.
- Whole Window
Loads the detail report into the full browser window.
- New Window
Loads the detail report into a new window. This window is not named.
Note: If you specify the detail report to be opened in a new browser window, it will be opened independently when you click the trigger in JReport Web. That is, the join and filter conditions will not be applied.
- Parent Frame
Loads the detail report into the parent frame of the frame in which the master report is.
- Other Frame
Loads the detail report into some other specified frame. If the frame name does not exist, the detail report will be loaded into a new window.
- Click OK to confirm.
After a set of master/detail reports have been defined in JReport Designer and published to JReport Enterprise Server, they can be viewed in DHTML. The detail report supports all the DHTML operations, such as sort, filter, drill, and search.
