Home | Table of Contents | Group Key | CloverETL 4.6.1
--- | --- | ---
Prev | Specific Attribute Types | Next

### Group Key

Sometimes you need to select fields that will create a grouping key. This can be done in the Edit key dialog. After opening the dialog, you need to select the fields that should create the group key.

Select the fields you want and drag and drop each of the selected key fields to the Key parts pane on the right. (You can also use the Arrow buttons.)

Figure 30.13. Defining Group Key

After selecting the fields, you can click the OK button and the selected field names will turn to a sequence of the same field names separated by semicolon. This sequence can be seen in the corresponding attribute row.

The resulting group key is a sequence of field names separated by semicolon. It looks like this: `FieldM;...FieldN`.

In this kind of key, no sort order is shown unlike in Sort key. By default, the order is ascending for all fields and priority of these fields descends down from top in the dialog pane and to the right from the left in the attribute row. See Sort Key for more detailed information.

When a key is defined and used in a component, input records are gathered together into a group of the records with equal key values.

#### Ordering Type

The key is ordered in following ways:

1. Ascending - if the input records are sorted in ascending order

2. Descending - if the input records are sorted in descending order

3. Auto - the sorting order of the input records is guessed from the first two records with different value in the key field, i.e., from the first records of the first two groups.

4. Ignore - if the input records with the same key field value(s) are not sorted

Group key is used in the following components:

- Group key in SortWithinGroups

- Merge key in Merge

- Partition key in Partition, and ParallelPartition

- Aggregate key in Aggregate

- Key in Denormalizer

- Group key in Rollup

- Also Partition key that serves for distributing data records among different output ports (or Cluster nodes in case of clusterpartition) is of this type. See Partitioning Output into Different Output Files

Prev | Up | Next
Time Intervals | Home | Table of Contents | Sort Key