Dynamic Field Extension

Contributed by @cjhoward18

This pipeline pattern helps dynamically create fields from a series of field value pairs in a string.

The CSV Generator creates sample content as follows:


We want to separate the entries at the ampersands, with the letters being the key and the numbers being the associated value.

In the Mapper, the expression to split the data into key value pairs is as follows:

$.extend($.field1.split("&").map(keyVal => keyVal.split("=")).map( val => {[val[0]]: val[1]}).reduce((accum, curr) => curr.merge(accum), {}))

The result data looks like this:

“field1”: “a=1&b=2&c=3”
“c”: “3”
“b”: “2”
“a”: “1”

Source: series of field value pair strings
Target: Dynamic Fields
Snaps Used: CSV Gererator, Mapper


Dynamic Field Extension.slp (3.2 KB)

1 Like