Use of Templates in Report using BIRT

Exclusive offer: get 50% off this eBook here
BIRT 2.6 Data Analysis and Reporting

BIRT 2.6 Data Analysis and Reporting — Save 50%

Create, Design, Format, and Deploy Reports with the world's most popular Eclipse-based Business Intelligence and Reporting Tool

$26.99    $13.50
by John Ward | July 2010 | Open Source

BIRT is an open source business intelligence and reporting tool, built on top of the Eclipse Framework. BIRT is used by developers for building reports that can best represent data and tell a story of that data that is easy to follow. In addition, BIRT can be integrated into a product, to allow that product to provide reporting capabilities.

In this article by John Ward,author of BIRT 2.6 Data Analysis and Reporting we will look at templates. Templates are existing report layouts that can be used as a starting point for new reports. This is useful if we use a similar layout in all our reports; we can then create a template and build from that for each new report.

Templates

Templates are predesigned report layouts.

Building a report from a template

Templates, for the most part, take the leg work out of having to recreate the same layout over and over again.With templates, we could either use the existing, canned Listing Report template or build our own, saving your time for more complex tasks. It's as simple as creating a new report, using a template, and following the Cheat Sheets.

In this example, we are going to use a Grouped Listing report template to create a simple Employee Sales Detail report, which we will use as a target for a drill down report.

  1. Create a new report called Employee Sales Details Report.rptDesign.Do not go through the wizard; stop at the template selection dialog.
  2. On the New Report – Template screen, select Grouped Listing report.

  3. When the report design opens, the Cheat Sheet is open on the right-hand side. It lays out a series of steps to create a basic report. As we already have the data source created in our library, go ahead and add the data source from the library, and click on the skip option for the data source hint.

  4. For the dataset, click on the Click to perform option. Name the dataset Get Employee Sales, and use the following query:

    select
    EMPLOYEES.EMPLOYEENUMBER,
    EMPLOYEES.LASTNAME || ', ' || EMPLOYEES.FIRSTNAME name,
    ORDERDETAILS.PRICEEACH sales,
    ORDERS.ORDERDATE
    from
    EMPLOYEES,
    CUSTOMERS,
    ORDERS,
    ORDERDETAILS
    where
    ORDERS.ORDERNUMBER = ORDERDETAILS.ORDERNUMBER
    and EMPLOYEES.EMPLOYEENUMBER = CUSTOMERS.
    SALESREPEMPLOYEENUMBER
    and ORDERS.CUSTOMERNUMBER = CUSTOMERS.CUSTOMERNUMBER
    and ORDERS.ORDERDATE between ? and ?

  5. Create two report parameters called startDate and endDate, and bind them to the data set parameters. For startDate, use the default value of 2005-01-01, and for endDate, use the default parameter of 2005-04-01.

  6. When we are back at the Cheat Sheet, we click on Click to Complete for the dataset.
  7. For the Edit Date Binding cheat sheet section, drag the fields over like next screenshot. Make the Group Header row appear with a silver background and the text appear in bold.
  8. When we drag EmployeeNumber over, it will automatically create the group on the EmployeeNumber express. Just be sure to drag it to the GroupHeader section as illustrated in the screenshot.
  9. Select the column with the Name and OrderDate fields, and select Suppress duplicates.
BIRT 2.6 Data Analysis and Reporting Create, Design, Format, and Deploy Reports with the world's most popular Eclipse-based Business Intelligence and Reporting Tool
Published: July 2010
eBook Price: $26.99
Book Price: $44.99
See more
Select your format and quantity:
  • Select the Group Header row, and under the Property Editor, choose the Bookmark tab. Use the following expression:

    row["EMPLOYEENUMBER"]

  • Now we have built a report based on a template. Consuming other templates is similar, where a Cheat Sheet can be used.

    Creating a template

    Creating templates can be done by using the new file menu. From there, new templates can be registered with BIRT to be shown on the New Report wizard.Let's take a look at creating a new template from scratch.

    1. Go to File New | Template|.
    2. Call the template as myNewTemplate.rptTemplate.
    3. Enter My First Template for the Display Name.
    4. Enter Testing a new Template for the Description.
    5. If we have an image, we can associate it with one with our template using the Template Image option.

    Now we have a new template to create reports from. Go into the template and create any sort of layout you would like, just like with a regular report design, and save that layout. When we want to use this template, we can simply open it and save it as a report design. If we wish to show this up in the New Report wizard, let's use the following steps.

    1. In the Navigator, right-click on the template we just created and select File Register Template with New File Wizard…|.

    2. Follow the wizard to create a new template.

      So, what about the Cheat Sheets that we saw in the canned templates? Well, Cheat Sheets are simply XML files that explain the steps that are installed as Eclipse plugins.However, it is possible to create new Cheat Sheets if we are familiar with the process. So, let's say we want to associate the My First Report template cheat sheet with the template we just created. Under the Report Propterites/Propterties, we would put in the plugin class under the Cheat Sheet Property. The Dev2Dev article, Building Cheat Sheets in Eclipse, provides a good tutorial on building Cheat Sheets, and is available at http://www.oracle.com/technology/pub/articles/dev2arch/2006/08/eclipse-cheat-sheets.html.

    Summary

    In this article we learned how to use existing report layouts that can be used as a starting point for new reports.We can also create templates using stylesheets.


    If you have read this article you may be interested to view:


    BIRT 2.6 Data Analysis and Reporting Create, Design, Format, and Deploy Reports with the world's most popular Eclipse-based Business Intelligence and Reporting Tool
    Published: July 2010
    eBook Price: $26.99
    Book Price: $44.99
    See more
    Select your format and quantity:

    About the Author :


    John Ward

    John Ward is a consultant for Innovent Solutions, specializing in BIRT and e-commerce search and navigation solutions. Prior to that, John was an Assistant Vice President for Citibank, North America, managing the training MIS group and overseeing development of new technology-based training initiatives. John actively works with and tests BIRT—an open-source reporting platform built on Eclipse—including development work based on BIRT reports and the BIRT APIs.

    John also maintains The Digital Voice blog at http://digiassn.blogspot.com

    Books From Packt


    JasperReports 3.6 Development Cookbook
    JasperReports 3.6 Development Cookbook

    Liferay Portal 6 Enterprise Intranets
    Liferay Portal 6 Enterprise Intranets

    Microsoft Dynamics NAV 2009 Application Design
    Microsoft Dynamics NAV 2009 Application Design

    Drupal E-commerce with Ubercart 2.x
    Drupal E-commerce with Ubercart 2.x

    Pentaho 3.2 Data Integration: Beginner's Guide
    Pentaho 3.2 Data Integration: Beginner's Guide

    IBM Cognos 8 Report Studio Cookbook
    IBM Cognos 8 Report Studio Cookbook

    Oracle Siebel CRM 8 Installation and Management
    Oracle Siebel CRM 8 Installation and Management

    Oracle SOA Suite 11g R1 Developer's Guide
    Oracle SOA Suite 11g R1 Developer's Guide


    No votes yet

    Post new comment

    CAPTCHA
    This question is for testing whether you are a human visitor and to prevent automated spam submissions.
    F
    G
    Q
    x
    p
    s
    Enter the code without spaces and pay attention to upper/lower case.
    Code Download and Errata
    Packt Anytime, Anywhere
    Register Books
    Print Upgrades
    eBook Downloads
    Video Support
    Contact Us
    Awards Voting Nominations Previous Winners
    Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
    Resources
    Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software