Merging the grouped products

Transformer example on how to merge the grouped records on the dashboard.

The next step would be to merge the two leftover products back into one array. This can be done with the following configuration. First, select the Value mapper transformer. This transformer will utilize accessors and mappers to perform operations on the entity.

First, under Accessor, select the Pattern accessor. This accessor uses the same logic to select information as for example the Pattern move transformer. We want to operate on the grouped products, so we for the pattern, use products-grouped.


Now for the mappers. We first want to reset the keys of the products-grouped node, so we can use an operator later on to merge the two arrays. For the first mapper we select the List: Get values mapper. This mapper will reset the keys of the array to numeric values. This mapper expects no further configuration.

Because our initial accessor has selected the parent node we want to operate on, and the keys of the children have been reset. Our target with the accessor is still correct, so we can keep using this Value mapper and don't have to create a new one.

Add another mapper and select the Operator mapper. On this mapper, an operator can be configured to perform a task. The operator we want to use is the Array Merge operator. This operator will merge the children by passing it as a variadic to the operator, which uses the native array_merge method.


If we run the transformer tester now, we can see that the two arrays have successfully joined together.

Now we want to move the products back to their original node, so we use another Pattern Move transformer to do so. For the pattern use products-grouped and for the replacement use products.