1. Presentation
2.Basic concepts
3.Input
From File
From DB
Custom input
4.Output
HTML
Excel
Custom
5.Flat reports
Simple
Aggregated
6.Cross tab reports
Simple
Aggregated


2.1 Main concepts

Before starting with the first report example let's see a short description of the main components :

  • The Input - represents the input that will be formatted and processed by this engine
    Normally the input data resides in database tables or in data files (stored on your hard drive) but
    with the help of this API, you can read from other kind of data sources by providing your own
    implementations and for the input interfaces The common classes needed for Input are provided by the engine in the net.sf.reportengine.in package

  • The Algorithm - this is the core of this system and needs no user intervention.

  • The Output - the formatted result of the algorithm.
    Usually the result is presented in a HTML or PDF or XLS page and contains not only the formatted input data but
    also some other information (like the result of some calculations/aggregations)

For each report you should set an input and an output. All the rest ( what I like to call - "dirty work") is done by the default Algorithm

already set in the tools provided by this library

2.2 Other concepts

  • Flat reports - This is the name for a simple report where the input data is formatted and displayed on a single axis
  • Calculator - an implementation for net.sf.reportengine.core.calc.ICalculator interface which is basically a group function. Some default group functions are provided whithin net.sf.reportengine.core.calc package : SumCalculator, CountCalculator, Max, Min and so on
  • Aggregation - grouping of data in order to apply a group function on each group (i.e. SUM, COUNT ...etc)
  • Let's take a short example: given the folowing data (which I call Input)
    		Coca-Cola	1st	100
    		Coca-Cola	2nd	200
    		Coca-Cola	3rd	300
    		Coca-Cola	4th	400
    		McDonald's	1st	100
    		McDonald's	2nd	200
    		McDonald's	3rd	300
    		McDonald's	4th	400
    		Microsoft	1st	100
    		Microsoft	2nd	200
    		Microsoft	3rd	300
    		Microsoft	4th	400
    	
    Presenting data as it is it's not one of our best options . If we group data we can have a better report especially if we want to present some totals :
    		Coca-Cola	1st	100
    		Coca-Cola	2nd	200
    		Coca-Cola	3rd	300
    		Coca-Cola	4th	400
    		
    		People hired by Coca-Cola  : 1000
    		
    		McDonald's	1st	100
    		McDonald's	2nd	200
    		McDonald's	3rd	300
    		McDonald's	4th	400
    		
    		People hired by McDonald's  : 1000
    		
    		Microsoft	1st	100
    		Microsoft	2nd	200
    		Microsoft	3rd	300
    		Microsoft	4th	400
    		
    		People hired by Microsoft  : 1000
    		
  • Cross tab report - A report which displays data on 2 axis
  • CompanyQuarter
     1st2nd3rd4th
    Coca-Cola100200300400
    McDonald's100200300400
    Microsoft100200300400
    As you can see this report contains the same data as the first one. The difference is the way of showing data:
    Some data has been displayed on the table header (see 1st, 2nd,3rd, 4th) resulting a report having data on two
    axis X and Y.

Support This Project java.net community ©dragos balan