Creating a report document
Generate a report document from a report design by choosing RunGenerate Document. Specify the folder in which to save the report document. To share the report document with other report developers, put the file in a shared resource folder.
When used as a data source, the report document provides access to its result sets. At report generation, a result set is created for each table, chart, cross tab, and list. The data in a result set is defined by the data column bindings created for a table, chart, cross tab, or list. A report design has access to all result sets in a report document, except for a cross tab’s result set.
For example, Figure 7‑12 shows a report that displays sales data in two tables and a chart.
Figure 7‑12 A report displaying data in two tables and a chart
A report design that uses a report document generated from this report has access to the result sets generated for the two tables and the chart. When you create a data set to specify which result set data to use, the data set editor displays all the available results sets, as shown in Figure 7‑13.
Figure 7‑13 Data set editor displaying available result sets with default names
The result sets are organized under three categories: Bookmark, Element ID, and Result Set ID. The result sets named __bookmark_1, __bookmark_2, and __bookmark_3 correspond to the result sets for the first table, the chart, and the second table, respectively. Similarly, the result sets named Table_252, Chart_312, and Table_6 correspond to the result sets for the first table, the chart, and the second table. Finally, the result sets named QuRs0, QuRs1, and QuRs2 also correspond to the result sets for the first table, the chart, and the second table.
While it seems redundant to provide three methods to select any given result set, each method offers different benefits.
*For result sets that appear under Bookmark, the report developer designing the report from which a report document is generated can specify descriptive names. The name can be a literal string or an expression.
*For results sets that appear under Element ID, the report developer can also specify descriptive names, but can only use literal strings to do so. Result sets are also organized hierarchically if a report, such as a master-detail report, contains nested tables.
*For result sets that appear under Result Set ID, the report developer cannot specify alternate names. These generated names are useful for accessing a result set programmatically.
Figure 7‑14 shows another example of the data set wizard displaying the result sets available to a report design.
Figure 7‑14 Data set editor displaying two result sets with custom names
This time, the result sets under Bookmark use custom names, rather than the default __Bookmark_#. Result sets under Element ID are organized hierarchically under Orders and Payments, which are custom names. This hierarchy reflects the structure of data in the report document.
Specifying bookmark names
As Figure 7‑13 showed, BIRT generates a bookmark for each result set, and assigns bookmark names using the __bookmark_# format. If you are designing the report from which to generate a report document, you can specify more descriptive bookmark names to better identify the data in result sets. For example, instead of using the default name, __bookmark_1, to refer to the result set for the sales summary table, specify a name, such as Sales Totals by State.
How to specify a bookmark name
1 Open the report design to be used to generate a report document.
2 In the report layout, select the table, chart, or list for which to specify a bookmark.
3 In Properties Editor—Properties, choose Bookmark.
4 In Bookmark, specify one of the following:
*A name, such as "Sales Totals by State". If typing a name, enclose it within double quotation marks, as shown in Figure 7‑15.
Figure 7‑15 Specifying a bookmark name for an element
*An expression, such as the following:
row["COUNTRY"]
"Order: " + row["ORDERNUMBER"]
Specify an expression if, for example, a table is nested within another table or a list. In this case, the generated report document typically contains multiple instances of the inner table, and each table instance has a result set. If each table instance provides data about a particular sales order, for example, it is useful to identify each result set by order number, as shown in Figure 7‑14.
5 Save the report.
Specifying element names
BIRT also assigns an element ID for each result set. As Figure 7‑13 showed, each ID consists of the element type, an underscore, and a number, for example, Table_252 or Chart_312. If you are designing the report from which to generate a report document, you can specify more descriptive element IDs to describe the data in result sets.
How to specify an element name
1 Open the report design to be used to generate a report document.
2 In the report layout, select the table, chart, or list for which to specify a name.
3 In Properties Editor—Properties, choose General.
Notice that the Name property is undefined. Notice, too, that the Element ID property has a read-only number, which BIRT automatically assigns to every report element. BIRT uses this number in the default result set name.
4 In Name, type a descriptive and unique name. A report cannot contain duplicate element names. Figure 7‑16 shows an example of a name, Sales Chart, specified for a chart.
Figure 7‑16 Specifying a name for a chart element
5 Save the report.