Main classes in the JFreeReport class library.
Main classes in the JFreeReport class library.
Some rules when working with the report definition objects:
- Functions cannot be added to the report once the report generation has
started.
- Do not modify the report structure after the report
generation is started, unless you know exactly what you are doing.
- It is safe to modify the report definition before the report is
started.
- Once the report processing has started, the report from the report
processor must not be reused for other purposes.
Groups
A group is a set of database rows, where the contents of the group
fields are equal for all rows.
Lets look at the following table:
Car | Color | Price |
---|
Toyota | blue | 10.000 |
Toyota | blue | 20.000 |
Toyota | red | 15.000 |
Lexus | blue | 25.000 |
Lexus | yellow | 15.000 |
BMW | yellow | 40.000 |
BMW | blue | 35.000 |
BMW | green | 5.000 |
Groups are always defined on sorted tables.
A group is defined by selecting one or more rows, which should
form the group. A group instance will contain all rows from the
beginning of the group until one of the group fields changes.
Lets select the row car for our group:
Selecting that row as group argument will result in 3 group instances.
The first group instance will contain the first 3 rows (as the contents
of these rows are equal).
The next instance will contain all rows of the "Lexus" car and the
last group contains all rows from the "BMW" rows.
If a group is defined by more than one field, then the group will end,
if one of the group member fields changes.
Lets define a group which consists of "Car" and "Color".
The first instance of the group will contain the first 2 rows (Toyota,blue).
Then the value in the column "Color" changes, so a new group
instance is started. This new group contains a single row, as the
column "Car" in the next row will contain a different value.
The next two group instances are "Lexus, blue" and "Lexus, yellow", both
group instances contain 1 row, as the color changes after 1 row.
The next row starts a new group, as the column "Car" contains a different
value (BWM instead of Lexus). It doesn't matter, that the color is still
equal, to end a group instance, it is sufficient that one column value
changed.