cancel
Showing results for 
Search instead for 
Did you mean: 

Comma Separated String into Rows

arvindnsn
Contributor

  Hello,

   I have a requirement where a text with "," delimiter has to be generated into rows.

 For Example a string or text  $src_name = "AMK, ACK, AGK, ABK" should be generated as following rows.

The output should be separate rows as below.

AMK

ACK

AGK

ABK

I tried using the Group by N with group size set to 0 and then use the expression "group.split(‘,’) " in the mapper following the Group by N as below. I am getting error and not able to find a way to solve this.

Any help is appreciated.

Thanks

Aravind N

 

 

  

1 ACCEPTED SOLUTION

SpiroTaleski
Valued Contributor

@arvindnsn 

1) First try to split the string by "," - and as an output you will receive array of records: 

                ("AMK,ACK,AGK,ABK").split(',')

               output: ["AMK","ACK","AGK","ABK"]

2) Then split the array, using JSON Splitter Snap. 

BR,

Spiro Taleski

View solution in original post

2 REPLIES 2

SpiroTaleski
Valued Contributor

@arvindnsn 

1) First try to split the string by "," - and as an output you will receive array of records: 

                ("AMK,ACK,AGK,ABK").split(',')

               output: ["AMK","ACK","AGK","ABK"]

2) Then split the array, using JSON Splitter Snap. 

BR,

Spiro Taleski

This worked well. Thank you.

Also, Is it possible if this can be achieved in a single mapper expression without using the splitter.