The Co-Group node is used to group two inputs based on a common identity field and then join associated fields from each input.
For example, consider the following two sheets, Sheet 1 and Sheet 2:
Name |
Amount A |
---|---|
Bob |
1 |
Bob |
2 |
Alice |
3 |
Carol |
4 |
Sheet 1
Name |
Amount B |
---|---|
Bob |
5 |
Alice |
6 |
Alice |
7 |
Carol |
8 |
Sheet 2
Performing Co-Group with the Name field from Sheet 1 as the left input and the Name field from Sheet 2 as the right input would result in the following:
Name |
Left |
Right |
---|---|---|
Bob |
[{A = 1}, {A=2}] |
[{B = 5}] |
Alice |
[{A = 3}] |
[{B = 6}], [{B = 7}] |
Carol |
[{A = 4}] |
[{B = 8}] |
Sheet 3
Co-Group creates records associating all values for each identity field. Values are grouped as arrays, with a field for each input source. Arrays can then be used by other nodes, in computations.