Perform operations within entity data

This guide explains how to perform operations between two properties within entity data.

The input data contains two properties. The `items` and the `filter` property. The `items` need to be filtered so that only the colors that are not in the `filter` array remain. Screenshot from 2020-11-25 17-09-29

 

The "Operator Transformer"  can be selected to perform operations between two properties within the entity data.

A path to the first/left property and the second/right property need to be entered. The values "items" and "filter" are entered.

Then an "Operation" can be selected. The "Array Diff" operator is selected. This operator will perform an "array difference" operation and will populate the field configured in the "Destination path" with the result.

 

Screenshot from 2020-11-25 17-12-58

 

 

Several operations are available. The opposite result, i.e. only keep the colors in the "filter" property, by selecting the "Array Intersect" property. The values can be combined with the "Array merge" operator. Other operators are available to perform calculations, and to perform operations on other data types like strings.

A second transformer, the "List mapper" is added to filter out the old properties. 

The "Key accessor" with and empty "Root" path is added. This makes a selection of all properties within the entity data.

Then the "List: Intersect keys" mapper is added. The mapper removes all properties that are not entered. All keys except the "result" key are removed.

The final result is a new data structure with the colors originally in the "filter" property filtered out.

Screenshot from 2020-11-25 17-13-19

Screenshot from 2020-11-25 17-12-46