user2471320
user2471320

Reputation: 93

Splitting the comma separated values in a column into multiple columns in Snaplogic

I have table data like below.

OTDATA

"ABC,CDE,EDF,123,10/20/2020"

"WDE,RED,ERT,231,09/22/2020"

"ERT,WED,TGY,453,08/10/2020"

I am trying to split into below through snaplogic.

OTDATA,OTDATA,OTDATA,OTDATA,OTDATA

ABC,CDE,EDF,123,10/20/2020

WDE,RED,ERT,231,09/22/2020

ERT,WED,TGY,453,08/10/2020

I have used mapper to do $OTDATA.split(',') but I am not achieving the desired output. Can you please give me a way to do it?

Upvotes: -2

Views: 780

Answers (1)

Bilesh Ganguly
Bilesh Ganguly

Reputation: 4141

You can use two mappers one after the other with one mapper that splits the string and the other mapper that maps the elements of the resulting array to its corresponding fields.

Please note that you can't have fields with the same name.

Please refer to the following screenshots.

#1 Mapper that splits the string

Split string

#2 Mapper that maps the array elements to corresponding fields

Final mapper

Upvotes: 0

Related Questions