Skip to content

Group By Keys

Group By Keys puts together the records that have the same value in the fields you choose. For each distinct combination it returns a single record with those values and a list with the rest of the data of each grouped record. It is the opposite of Flatten By Key.

When to use it

  • You have one row per order line and want one record per order with all its lines.
  • You want to group your customers by country and city before preparing a campaign.
  • You need to send each sales rep a single message with all their opportunities.
  • You want to group incidents by category to summarise them.

Configuration

FieldWhat it does
DataThe records you want to group.
Group Key(s) (required)The fields to group by, separated by commas, for example country,city.

Advanced options

FieldWhat it does
Aggregated Field NameThe name of the field where the list of grouped data is stored. Default: items.

Output

The Grouped Data output returns one record per distinct combination of values. Each record holds the grouping fields and a field (items by default) with the list of the other data of each original record. Groups come out in the order they first appear.

Example

A sales team has a list of opportunities with the fields sales_rep, customer and amount, and wants to send each rep a summary of theirs.

  1. Connect the list to Data.
  2. In Group Key(s), type sales_rep.
  3. Each output record has the rep’s name and, in items, the list of their customers with the amount. Connect it to an agent that writes the summary, or to Loop to send an email to each one.