Categories: TutorialsData

Use of Templates in Report using BIRT

2 min read

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.
Packt

Share
Published by
Packt

Recent Posts

Top life hacks for prepping for your IT certification exam

I remember deciding to pursue my first IT certification, the CompTIA A+. I had signed…

3 years ago

Learn Transformers for Natural Language Processing with Denis Rothman

Key takeaways The transformer architecture has proved to be revolutionary in outperforming the classical RNN…

3 years ago

Learning Essential Linux Commands for Navigating the Shell Effectively

Once we learn how to deploy an Ubuntu server, how to manage users, and how…

3 years ago

Clean Coding in Python with Mariano Anaya

Key-takeaways:   Clean code isn’t just a nice thing to have or a luxury in software projects; it's a necessity. If we…

3 years ago

Exploring Forms in Angular – types, benefits and differences   

While developing a web application, or setting dynamic pages and meta tags we need to deal with…

3 years ago

Gain Practical Expertise with the Latest Edition of Software Architecture with C# 9 and .NET 5

Software architecture is one of the most discussed topics in the software industry today, and…

3 years ago