Aggregations

Aggregations are a way to take data as a whole and apply calculations to them, such as counts or sums of data columns. New to BIRT 2.3+ is the aggregation visual component. In newer versions of BIRT, the developers have broken away from the older, scripting based aggregations. With improvements made in the 2.5 series, it is now possible to do some very powerful and interesting things such as using aggregations in groupings for charts, which wasn't possible in BIRT before. Let's take a look at how to build a simple count aggregation for the employees in our offices.

  1. Create a new report titled employeeGroupCount.rptDesign.
  2. Create a new Data Source off the Classic Models sample database.
  3. Create a new dataset called dsEmployeeOffices using the following query:
    select
    EMPLOYEES.EMPLOYEENUMBER,
    OFFICES.OFFICECODE,
    OFFICES.CITY,
    OFFICES.STATE
    from
    EMPLOYEES,
    OFFICES
    where
    OFFICES.OFFICECODE = EMPLOYEES.OFFICECODE
    
  4. Right-click on dsEmployeeOffices and select Insert in Layout.
    Aggregations
  5. Select the table and add a new grouping on the OfficeCode column.
    Aggregations
  6. Format the table so that the City, State, and OfficeCode are in the Group header.
    Aggregations
  7. Drag an Aggregation component into the Group Footer Row, in the center column. Name the aggregate, change the data type to Integer, and set the function to COUNT. For the Expression, use row["EmployeeNumber"]. Make sure that under Group option, the grouping made for the table is selected.
    Aggregations
  8. Insert a label into the cell to the left of the aggregation and name it Employee Count.
    Aggregations
  9. Run the report. The following example had formatting added to make it easier to read:
Aggregations
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset