o7planning

BIRT reporting Programming Tutorial for beginners

  1. Introduction
  2. Reporting interface after project completion
  3. The installation requires
  4. Create BIRT Project
  5. Create Data Source
  6. Create dataset
  7. Create new Report
  8. Configuring the size of the report
  9. Interface Design (Header)
  10. Design charts
  11. Run reports for the first time
  12. Designing the body of the report
  13. Run report (2)
  14. Edit style (1)
  15. Run report (3)
  16. Sub Total
  17. Run Report

1. Introduction

This document is based on:
  • Eclipse 4.4 (LUNA) (or newer)
  • BIRT 4.4

2. Reporting interface after project completion

This is a photo of report will be made in this document:
Raw data:
First of all, we need to understand some professional knowledge:
  • A CUSTOMER can create one or more ACCOUNT in a branch of some bank.
  • Each account corresponds with a service PRODUCT provided by the bank.
  • Each account has an AVAILABLE BALANCE.
For convenience, you can look at the following raw data.
** SQL **
Select Acc.Account_Id
    ,Acc.Cust_Id
    ,Cus.Address        Cust_Address
    ,Acc.Product_Cd -- Product Code (Service of Bank)
    ,Acc.Open_Branch_Id -- Branch (of Bank)
    ,Bra.Name           Branch_Name
    ,Acc.Avail_Balance -- Available Balance
From   Account  Acc
    ,Customer Cus
    ,Branch   Bra
Where  Acc.Cust_Id = Cus.Cust_Id
And    Acc.Open_Branch_Id = Bra.Branch_Id;

3. The installation requires

BIRT Plugin:
For programming BIRT report, you need to install BIRT tools into Eclipse. You can see the instructions at:
Sample database:
LearningSQL is a small database used commonly in the instruction of o7planning. The instruction of programming BIRT report also uses data on this Database. You need to create this Database (It takes only 5 minutes) as the following instruction:
JDBC Driver library for Databases (Oracle, MySQL, SQLServer) and its use:
Depending on the type of Database, you use the equivalent JDBC Driver library of that Database (It takes you 3 minutes to finish it), look at the instruction of download at:

4. Create BIRT Project

In Eclipse select:
  • File/New/Other...
Enter Project name:
  • HelloBIRT

5. Create Data Source

Create a Data Source from JDBC, or XML,... In this document, we will create Data Source from JDBC connected with LearningSQL database.
Here I connect JDBC with LearningSQL database (on DB Oracle). However, other Database manipulation is carried out alike.
ojdbc6.jar is a JDBC Driver library for Oracle
Check whether database LearningSQL has been connected or not.

6. Create dataset

Enter:
  • Data Set Name: Account avail balance
Select Acc.Open_Branch_Id
     ,Bra.Name           Branch_Name
     ,Acc.Cust_Id
     ,Cus.Address        Cust_Address
     ,Acc.Account_Id
     ,Acc.Product_Cd
     ,Acc.Avail_Balance
From   Account  Acc
     ,Customer Cus
     ,Branch   Bra
Where  Acc.Cust_Id = Cus.Cust_Id
And    Acc.Open_Branch_Id = Bra.Branch_Id
Order  By Acc.Open_Branch_Id

7. Create new Report

In Eclipse select:
  • File/New/Other...
  • File name: BranchReport01.rptdesign

8. Configuring the size of the report

We create a default report whose size is the same as that of an A4 paper.
Select property:
  • Orientation: Landscape
Configuring Border:
You can also change other properties.

9. Interface Design (Header)

<H3>
Vietcombank
</H3>
<B>
<I>
For internal use only
</I>
</B>

10. Design charts

11. Run reports for the first time

12. Designing the body of the report

Raw data like the illustration below:
But we will design the report so that its display is more simple and eye-catching (As the below illustration)
We will carry out step by step.
Drag and drop Table icon into the screen of report.

13. Run report (2)

14. Edit style (1)

The report runs, but its interface is not beautiful. We need to adjust some styles.

15. Run report (3)

16. Sub Total

17. Run Report