Table Of Contents
- Use case
- General description
- The different parts of the “Recursively copy value to children” Transformer
- Guide
- Video guide
Use case
It is a common practice in eCommerce to have numerous variations of a product. For example, a product can be sold in many colours and different sizes. However, there can be parent data that is consistent among all the variations. This transformer allows you to copy such parent data seamlessly to all the product variations.
General description
The “Recursively copy values to children” Transformer can copy a value from an entity to a nested/child property within the same entity data. It does so recursively if the nested/child property contains the same properties as the parent entity.
For example, the Transformer helps copy a product identifier from a main product to a list of sub products.
The different parts of the “Recursively copy value to children” Transformer
-
Pattern to children within a parent (required field)
This specifies the path in the entity data where the values should be copied to. -
Mapping of values from parent to child (required field)
This defines the data structure to copy to the children/nested data. It supports placeholders to reference data from the parent entity. -
Keep using the context from the first level
This field determines whether the placeholders will continue referencing data from the original parent entity, or from the current child element.
Guide
Here’s how you can implement the transformer.
Step 1: Click on Add Data Transformer and select Recursively Copy Values To Children transformer.
Step 2: Fill the field of Pattern to children within a parent by specifying the variants (or children).
Step 3: Fill the field of Mapping of values from parent to child by specifying the parent data (placeholders) that will be copied to its variants (or children)
Step 4: Upon clicking the Run Test button, you will observe that the transformer has copied the required data (mentioned in Step 3) to the variants.