cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic Field Extension

cjhoward18
Employee
Employee

Contributed by @cjhoward18


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

Dynamic%20Field%20Extension

The CSV Generator creates sample content as follows:

field1
a=1&b=2&c=3

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

Downloads

Dynamic Field Extension.slp (3.2 KB)

0 REPLIES 0