An example that shows how records can be grouped using the dashboard.
The first transformer we want to add is the Group records transformer. This transformer will be grouping our products by their types. If we do this, we can easily remove the configurable products.
First, click on the Add transformers button to add a new entry. Then select the Group records transformer from the dropdown. A few additional fields should now pop-up.
- In the Pattern field set the following value: products.*. This will select all the records in the products node. Because products is a numeric array, we use the * to select all the children individually.
- For the Path field set the value: type. This is the path we use within each child to select the field on which the grouping should be applied.
- Finally, for the destination fill in: products-grouped. This will tell the transformer to create a new node products-grouped to write the new grouped products.
Feel free to press the Test button to see the result of the current transformer.
The reason we used the products-grouped node instead of the products node to override the original data is, because this would merge the two arrays, this would result in a nasty-to-work-with array. So we are going to clear the products node with a simple trick that can be performed with the transformers.