2024 Update Rollup 1

Creating a Report With Eclipse BIRT Report DesignerPermanent link for this heading

This chapter provides a brief introduction to the Eclipse BIRT Report Designer. It is highly recommended to read dedicated BIRT literature to get an impression what BIRT has to offer. In the following chapters a BIRT report that is able to display the logbook management data is created from scratch.

Create a New ProjectPermanent link for this heading

  1. Get Eclipse BIRT (http://eclipse.org/birt: new window).
  2. Create a new “Report Project” and follow the wizard.
  3. Create a new “Report” and follow the wizard (create a blank report).

Get Sample XML DataPermanent link for this heading

The design process is based on a sample data source. In this case the generated XML data should be the data source. To avoid writing the XML file manually you can add following lines to the CreateBirtReport use case.

Example

GENCONT@1.1:ContentObject resultxmlobj =  
  #GENCONT@1.1:ContentObject.ObjectCreate()[2];
resultxmlobj.content.contcontent = xmlcont;
resultxmlobj.content.contextension = "txt";
resultxmlobj.objname = "Result XML " + coort.GetCurrentDateTime(cooobj);

Now you can search for the content object in Fabasoft Folio and use the XML as data source (may also be useful for debugging purposes).

Specify a Data SourcePermanent link for this heading

Use the previously generated sample XML as data source.

  1. Create a new data source.
  2. Select “XML Data Source” and specify the path to the sample XML file.

Specify Data SetsPermanent link for this heading

Based on the data source, data sets can be created. For the logbook management example two data sets are required:

  • A logbook management can contain several logbooks.
  • A logbook can contain several trips.

To put this hierarchy into relation the two data sets are used. The first data set selects the logbooks and the second data set selects the trips. The ID attribute of the logbook is used to match the trips with the corresponding logbook. This is a generic pattern when working with such hierarchies.

  1. Create a new data set.
  2. Name the data set “logbook”.
  3. To select all logbook XML elements, define as “Row Mapping” the XPath expression //logbook.
  4. In the “Column Mapping” section add the values that should be display in the report for logbooks or are used for computation (ID attribute).

To create the second data set, perform the following steps:

  1. Create a second data set named “logtriplog”.
  2. As “Row Mapping” use the XPath expression //logbook[@id="{?logbook?}"]/logtriplog. The XML attribute “id” is used to match the trip with the corresponding logbook.
    Note: BIRT only allows XML attributes for filtering, not XML elements.
  3. In the “Column Mapping” section add the values that should be display in the report for trips.
  4. When finishing the creation of the data set click “OK” to let the “logbook” parameter empty.

Arranging the ReportPermanent link for this heading

You can arrange the parts of the report mainly with drag and drop. In this example two lists are used that have a binding to the two data sets. The second list containing the trips uses the “logbook” parameter to display the trips that belong to the corresponding logbook.

  1. Switch to the “Palette” tab and drag a “List” to the report.
  2. Select “logbook” as binding in the “Property Editor” for this list.
  3. Drag a second list in the “Detail” section of the first list.
  4. Select “logtriplog” as binding in the “Property Editor” for this list.
  5. To define the parameter that is used for filtering the trips that belong to the logbook, click “Data Set Parameter Binding”.
  6. Specify row["id"] as value for the “logbook” parameter. This way the XML attribute “id” is used for filtering.
  7. Switch to the “Data Explorer” tab and drag “objname” and “logdescription” in the detail section of the first list right before the second list.
  8. Drag “trlfrom”, “trluntil” and “trlmiles” in the detail section of the second list.
  9. Switch to the “Preview” tab.

Now the desired report functionality is given. BIRT offers a lot of possibilities to improve the layout and format the values of a report. When you are glad with your report put it in the resources folder of your app.ducx project, run the project again and generate a PDF report with the new design.

A report of a fully featured logbook management project may look like this: