If the field which is added as the grouping criterion is of Numeric/String/Date/Time type, you can select a special function for the field in the Special Function column to group the data as required. This is called "grouping data by intervals" in JReport. It enables you to group data more clearly and logically, and to summarize data more effectively.
The following is a short description of each special function.
Functions for Numeric-typed group by fields
Function | Description |
---|---|
None | All the records that have the same field value will be displayed together as a group. |
Up to 5 | The records will be grouped by intervals of 5. |
Up to 10 | The records will be grouped by intervals of 10. |
Up to 50 | The records will be grouped by intervals of 50. |
Up to 100 | The records will be grouped by intervals of 100. |
Up to 500 | The records will be grouped by intervals of 500. |
Up to 1000 | The records will be grouped by intervals of 1000. |
Up to 5000 | The records will be grouped by intervals of 5000. |
Up to 10000 | The records will be grouped by intervals of 10000. |
Functions for String-typed group by fields
Function | Description |
---|---|
None | All the records that have the same field value will be displayed together as a group. |
For 1st letter | The records, of which the field values' first letter is the same, will be grouped together. |
For first 2 letters | The records, of which the field values' first two letters are the same, will be grouped together. |
For first 3 letters | The records, of which the field values' first three letters are the same, will be grouped together. |
For first 4 letters | The records, of which the field values' first four letters are the same, will be grouped together. |
For first 5 letters | The records, of which the field values' first five letters are the same, will be grouped together. |
For last 1 letter | The records, of which the field values' last letter is the same, will be grouped together. |
For last 2 letters | The records, of which the field values' last two letters are the same, will be grouped together. |
For last 3 letters | The records, of which the field values' last three letters are the same, will be grouped together. |
For last 4 letters | The records, of which the field values' last four letters are the same, will be grouped together. |
For last 5 letters | The records, of which the field values' last five letters are the same, will be grouped together. |
Functions for Date/Time-typed group by fields
Function | Description |
---|---|
None | All the records that have the same field value will be displayed together as a group. |
For each second | The records, of which the field values are in the same second, will be grouped together. |
For each minute | The records, of which the field values are in the same minute, will be grouped together. |
For each hour | The records, of which the field values are in the same hour, will be grouped together. |
For each day | The records, of which the field values are in the same day, will be grouped together. |
For each week | The records, of which the field values are in the same week, will be grouped together. |
For each bi-week | The records, of which the field values are in the same bi-week, will be grouped together. |
For each half month | The records, of which the field values are in the same half month, will be grouped together. |
For each month | The records, of which the field values are in the same month, will be grouped together. |
For each quarter | The records, of which the field values are in the same quarter, will be grouped together. |
For each half year | The records, of which the field values are in the same half year, will be grouped together. |
For each year | The records, of which the field values are in the same year, will be grouped together. |
In the special function list for all the above data types, there is an item called Customize. By selecting this item, you can define special functions.
If you want to group the data by intervals, check the By Intervals radio button, then define the interval in the Numerical Value text box.
If you want to group data by certain range, check the Within Range radio button, specify the range in the Within text box and select how to apply the range: apply to increasing data or decreasing data.
Note: When grouping Numeric typed data by intervals, JReport follows this rule: all values in each range are >= the minimum value in the range and < the maximum value in the range, and 0 is the offset for the intervals.
For example, if you specify to group the following values by intervals of 5: -8, -6, -5, -3, -1, 0, 1, 3, 4, 5, 8, the results will be as follows:
Ranges | Values |
---|---|
-10 to -5 | -8, -6 |
-5 to 0 | -5, -3, -1 |
0 to 5 | 0, 1, 3, 4 |
5 to 10 | 5, 8 |
For example, to group records by the first N letters of the group by field values, select First from the drop-down list and then enter N in the text box. Note that the number of letters should be an integer no larger than 255.
Note: If you check Case sensitive when grouping, No Conversion will be checked as the default converting method.
By default, JReport takes 1/1/1970 00:00:00 as the offset. If you want to define the offset by your own, check the Customized Value radio button and then click the calendar button to choose the required offset.
See also Customized Function dialog for detailed information about options in the dialog.