Forum Discussion
bchaubey
3 years agoNew Contributor
Hi Team, I want to normalize the data like below source
col1;col2
ABC;CC1,CC2,CC3
DEF;CC1,CC2,CC3
Target should be like below
col1;col2
ABC;CC1
ABC;CC2
ABC;CC3
DEF;CC1
DEF;CC2
DEF;CC3
May i know how it is possible in Snaplogic?
nsingam
3 years agoEmployee
Hi,
You can use the below expression a mapper followed by a splitter snap.
$value.split(“;”)[1].split(“,”).map(x =>$value.split(“;”)[0]+“;”+x)
in the above expression, $value is assumed to be the actual source value.
The example source json is as follows.
[{“value”:“col1;col2”},
{“value”:“ABC;CC1,CC2,CC3”},
{“value”:“DEF;CC1,CC2,CC3”}]