Forum Discussion

Surendar's avatar
Surendar
Contributor
8 years ago

How to convert comma separated values to rows in SnapLogic?

I have a requirement, based on the column values I need to split the records

ID NAME
1 abc,def,ghi
2 jkl,mno,pqr

ID NAME
1 abc
1 def
1 ghi
2 jkl
2 mno
2 pqr

Need to convert columns to rows in Snaplogic. Kindly let me know for any suggestions? thanks in advance!!

7 Replies

  • IMO, this can be achieved in 3 steps:
    Step 1. Split the Name on basis of comma.
    Step 2. Create an array using map() with ID and NAME as key like below:
    $array.map(x => {‘ID’: $ID,‘NAME’:x})
    Step 3. Use json splitter.

  • From a high level,

    use group by N with 0 documents, combine them into an array (group)

    group.toString().split(‘,’)

    • Surendar's avatar
      Surendar
      Contributor

      I have applied the same logic but getting error like below group itself undefined.

      • nganapathiraju's avatar
        nganapathiraju
        Former Employee

        Did you use the group by N before this?

        Also can you try with null safe access and see what you get?