Groups allow you to organize the records of a report with a better structure. A group is defined through an expression, so it can contain fields and variables, JasperRepors evaluates this expression and puts in the same group all the elements that have the same final result of the expression. When the result change then a new group is started. To create a new group go into the Outline view, right click on the root element (the report you have created) and select "Create Group", as shown in the image below:
Now the window to create a new group will appear:
From here, enter the group name and select your method for creating the new group:
In the previous example, we used the word "consecutive" for the grouped values. Suppose to spent $120 for two consecutive days, $200 the third day and $100 the fourth day. With these values three groups will be created: one with the first two elements, one with the third, and one with the fourth. This happens because the JasperReport:
This should clarify how the evaluation of the expression affects the creation of a group. Returning to the creation of the group, after we have selected the way how the group is evaluated we can click "Next" or "Finish". If we click next the following window will appear:
There you can select if you want the header and the footer of the group in the report. The group will be evaluated even without this two bands, but without any of them there aren't visually changes between a group and another (but the group can still be used for other calculations, see for example the evaluation time, reset type and the other fields in the variable section that uses the group to do some calculations). This because the bands Header and Footer will be always created, and them are visible in the outline view, but if one of the checkbox is unchecked then the relative band will not be placed into the report (in the outline view a band not visible in the report has its name in lightgray color). If you click finish in the previous screen instead of Next both the bands of the group will be created.