Groups and totals |
Top Previous Next |
Earlier we looked at the "Master-detail" report type, which printed data from two related sources. FastReport allows creating a report which looks in the same way, but uses one data source. For this, groups are used.
A group is a set of three bands: "Group header", "Data" and "Group footer". In designer, this looks as follows:
A group always contains a header and data. Group footer is optional, you can delete it.
In order to use a group, you should set the group condition for the group header, and connect the data source to the "Data" band. The condition can be any expression, but as a rule, this is one of the data source columns. Group printing is done in the following way:
Assuming that we have a Products table with the following data:
Data can be grouped on the CategoryName column. This column will be printed in the group header. The data itself is presented by the ProductName field. The report will be as follows:
If we run the report, the following will be seen:
|