6.1. Grouping data #

OpenCReports, being a report generator, works on tabular data: the data consists of ordered (named) columns and ordered or unordered rows.

It is often necessary to group data by certain properties. Imagine a list of employees of a company, grouped by their departments, pay grade, or location of employment. A report may show the list of the employees with visual separation according to any of these properties.

Multiple groupings may be prioritized (nested):

  1. by department

  2. by pay grade

With the above, in each department, subgrouping would separate employees according to the pay grade in that department.

For this to work, the rows of data must be fed to the report generator in a certain order. For example, in SQL the ordering can be done by:

SELECT ...
ORDER BY department,paygrade,employee;

This grouping of data is called a break in a report generator.