The Group By node can be used to group rows by a specified field. If there are duplicate values in the specified field, Group By will group those values into a single row.
Group By is useful when working with rows that contain field values you wish to aggregate.
For example, performing Group By on the Name field in the following sheet:
Name |
Salary |
---|---|
Bob |
$1,000 |
Bob |
$2,000 |
Alice |
$3,000 |
Would Group all duplicate Names into a single record, displaying the two records of Bob and Alice in the Group By node's sheet:
Name |
---|
Bob |
Alice |
At the same time, Group By would Group all Salary values for each record into one array per record.
Name |
Salary |
---|---|
Bob |
[{Salary = $1,000, Salary = $2,000}] |
Alice |
[{Salary = $3,000}] |
These array records will not be displayed in the Group By node's sheet; however, you could add a New Column to the sheet, that uses a function to aggregate these values.
For example, SUM(Salary), which would produce:
Name |
Salary |
---|---|
Bob |
$3,000 |
Alice |
$3,000 |