This lesson shows how to create a BIRT report design file
for a model report.
About this task
You use the Report Explorer view to create a new UML report.
You start with a template that populates the report with a data source
for the UML metamodel and some standard data sets.
Data sources
and data sets provide the data for BIRT reports:
- A data source specifies where to obtain the data. For model reports,
the data source is a set of models. You can use metamodels, instance
models, or both.
- A data set specifies the data to use in the report. For model
reports, each data set is a table of data that is extracted from a
data-source model. A data set consists of two parts: a "row-mapping"
part, which finds the model objects for the rows of the table, and
a "column-mapping" part, which finds attributes of the model objects
and organizes them as columns. Both the row-mapping and column-mapping
parts contain XPath expressions that use the metamodel structures
to query a target instance model when you run the report design to
generate a report.
Procedure
To create the BIRT report design file:
- Create a folder for the report design file:
- In the Project Explorer view, right-click Sample reporting project; then click .
- Type MyReport for the folder
name, and click Finish.
- Create the report design file:
- Click ; expand Reporting and double-click Report Explorer.
- In the Report Explorer view, expand and then right-click UML Model; then click New Report.
- In the Add New Report window, for
the report manager for the template, select UML Models.
- For the report to use as a starting template, click Blank UML Model Report and click Next.
- For the display name for the report, type Business Report.
- For the description of the report, type Reports
on the business use cases and business actors in a UML model to which
the Rational Business Modeling profile has been applied.
- Click Next.
- For the file name for the report, type businessReport.rptdesign.
- For the folder for the report, click Browse, navigate
to the MyReport folder in the Sample Reporting Project, and click Finish. The new Business Report is
displayed in the UML Model category in the Report Explorer view.
The report is not displayed in the Project Explorer view until you
refresh the view.
- Specify the sample business model as the data source for
the report:
- In the Report Explorer view, right-click Business Report; then click Open. The businessReport.rptdesign file opens in the report design editor.
- Click the Data Explorer tab to
open the Data Explorer view, expand Data Sources, right-click Main package; then click Edit.
- In the Edit Data Source window,
beside the display area for instance models, click Add.
- In the Load Resources window, click Browse Workspace. Expand Sample reporting
project, click Sample Business Model.emx, click OK, and click OK again.
Note: If you specify an instance model as a data
source, you can use example data to build data sets, and you can preview
the report.
The UML model that is listed in the data source under Metamodels is the UML.ecore metamodel. This metamodel
is predefined for each UML data source, which means that you can use
UML metamodel elements, as well as example data from the specified
instance model, to build data sets.
- In the Edit Data Source window, click OK.
- Add the report title, model name, and model documentation
to the report design:
- If the Palette is not displayed, click .
- To add a title to the report, in the Palette, click Label and drag the cursor into the report design editor.
- In the label box, type UML Business Use
Case Report.
- Specify a font and background color for the title,
and center the title text.
Note: To specify characteristics
such as font, background color, and alignment, right-click the label;
then click .
Use the pages of the New Style
window to specify style characteristics. For example, you can center
text in the Text Block page. You can also assign a descriptive name
to a style in the General page; this makes it easy to apply the same
style to other similar report design elements. It also helps you find
the style if you want to modify it.
For more information about
using BIRT features such as the palette and styles, see the Field
Guide to BIRT in the online help for your product. You might want
to experiment with different styles as you work through this tutorial.
- In the Data Explorer view, expand Data Sets and expand All Named Elements.
- Drag name into the report design
editor below the title.
- Specify the font and background color for the model
name, center the model name, and assign it a bottom margin of 24 points. You use the Box page of the Style window to assign margins.
- In the Palette, click Dynamic Text and drag the cursor into the report design editor. The Expression Builder opens. Unlike data items,
dynamic text items preserve rich text formatting from the model documentation.
- In the Expression field, type row["documentation"] and click OK.
- Click and in the Property Editor – Dynamic Text view, click the Binding tab.
- In the Data Sets field, select Package Root.
- To save the report, click .
- Click the Preview tab in the
report design editor. The model name and documentation
from the Sample Business Model.emx instance model are displayed. The
English version of the report should look similar the following figure,
though the characteristics of the styles that you used in your report
are probably different:
Results
Now you are ready to add content to the report.