What is the difference between Relation Reports and SubReports in the Rational Change Report Builder? When should these reports be used?
There is confusion among some customers about how these different report types should behave and when to use them. Often relation reports are used where subreports would be more appropriate. The result of such reports, although correct, may perhaps not be what was expected.
When planning a report, a decision is required as to whether a sub report or a relation report is most appropriate.
Subreports and relation reports are similar, in that both allow the user to look up an item related to the main report context item. For instance, if the context item is a CR, a secondary report to look up its associated tasks might be required.
However, subreports and relation reports differ in several ways. Perhaps most importantly, a relation report can only show one type of related object with reference to the main context object.
The definition of a relation report is similar to that of a top-level report, except that it does not have a separate query or a main template.
A subreport, on the other hand, has its own query that references the main context item. A subreport is actually a separate report that has been previously defined. It is included inside the top level report (in the attribute tab).
Relation reports can be chained together in a linear fashion. That is, each item can show a single related item.
Subreports enable reporting on multiple related items. This is done by including multiple subreports for the context item.
So, if the requirement is to show a CR and its tasks, both relation reports and subreports can do this. However, to show a CR with its tasks and attachments, a subreport would be required, because the relation report can only show one or the other (the tasks or the attachments, but not both at the same time).
A subreport shows a selection of set of objects obtained from a previously defined report. Typically, the objects are attachments (unlike relation report objects, for which the objects are CRs, tasks, or objects).
While relation reports are configured on the Main tab of the Report Builder dialog, it is not immediately obvious how to define a subreport. The following should help to clarify this:
Under the Subreports Included on Attribute Template list, click Add. The Add Subreport subdialog box appears.
Click Change Request, Task, or Object, depending on what type of subreport will be required. This action sets the Select Report list to the correct choices.
In the Select Report list, click the report to run. The Define Query dialog box appears.
In the Define Query subdialog box, create the query for the subreport.
A keyword for the type of object for which the main report is run must be included. For example, %problem_number, %task_number, or %cvid must be included in the query string to run reports for each CR, task, or object, respectively.