Template groups

Link copied to clipboard

Concepts

Link copied to clipboard

Template groups are necessary for performing/sorting subtotals on large sets of data. For example, you might need to make a list of all phone calls and include a subtotal for each country.

Concepts

Group

Link copied to clipboard

Each group is a portion of data that has an identical value for some parameter or parameters. All of the input data is sorted according to groups, and rows within the same group are presented together. In the example above, three groups are visible and each of them contains all calls made to some country.

Groups can also be nested. For example, the group “Country” contains several sub-groups named “Destination.” These are sorted according to their order in the list of groups so that the outermost group is on top, and the innermost at the bottom.

Template group

You can create your own custom groups (e.g., to group calls made from home country and from other countries). To configure custom group sorting, define the custom expression for the group break value. See details below.

Custom expression

This is a parameter that defines which group the data belongs to. All of the available data are sorted according to this field. In the example above, the list of all calls is sorted by the name of the destination country (so calls made to Slovenia appear before calls made to Ukraine). Next, rows that have the same custom expression value are grouped together in the same group, as seen in the example above for all calls made to Slovenia, Ukraine or the US.

Normally, the custom expression value is predefined for the selected group (in the example above, this is the “Country” column).  If you create your own groups, you can define a custom expression, specifying any valid SQL expression.

Group header

This is a template component that is inserted into the document immediately before the group data. Besides static text, variable fields (e.g., “Destination”) can also be used. In the example above, this is the row containing the name of the country.

Group footer

Similar to the group header, this element is placed immediately after the last row of the group. It can consist of static text and variable fields. In the example above, this is the row containing “TOTAL by” and the name of the country, as well as the total number of seconds and the amount for the country.

Group fields

These variable elements are very similar to data fields in the Columns section of a template (and are actually based on them). You can alter their parameters (such as format or post-processing rules) in exactly the same way as you would for standard elements of the Columns section.

Group totals

Since one group may consist of many rows of data, what would be the value in the group fields for the header/footer? The fields in the group header have the value of the first row in the group. You can specify how you would like to populate the value of fields in the group footer. Click Edit Edit next to the column and select one of the possible pre-defined options:

  • Summary (sum of values for the corresponding column across all rows)
  • Count (number of rows in the group)
  • Last value (value of this column in the last row)

You can always write your own custom total rules. These are very similar to post-processing rules, in that you can specify any Perl expression. The current value of the column is given in the $value variable, the current value of the total is given in the $total variable, and the result returned by the expression becomes the new total.

In the example below you see what a list of calls looks like if you use two groups:

  1. Break group by country (so that each group contains all calls made to the same country).
  2. Break group by destination. This group exists within the first group, so it contains all calls made to a specific destination within a certain country.

Group totals

On this page