Forum Discussion

SL12345's avatar
SL12345
New Contributor III
2 years ago
Solved

Split string into rows and save it to file row by row, not in one string

Lets say i have this input string in my mapper:

"Mercedes;6658;TypeS;2022;\r\nAudi;5558;TypeA8;2022;Diesel"

How can i save it to csv file as single rows? in this example it should be:

Mercedes;6658;TypeS;2022;
Audi;5558;TypeA8;2022;Diesel

I've tried myString.split('\r\n') it creates two strings which i can not export/save as file because its list, or these strings were comma separated and stored as one line in export file

Thank you for your help

6 Replies

  • Hello SL12345,

    Please refer to the attached sample pipeline, and let me know if this helps you!

    Regards,

    Aleksandar.

    • SL12345's avatar
      SL12345
      New Contributor III

      Looks good but question .... in my example  - one row has more fields than another row

      Is it possible to "connect"/export two  lines into one file but without empty field at the and of shorter row? 

      (Mercedes is shorter and CSV formatter creates last empty field) instead of this:
      "Mercedes";"6658";"TypeS";"2022";""
      "Audi";"5558";"TypeA8";"2022";"Diesel"

      get This

      "Mercedes";"6658";"TypeS";"2022";
      "Audi";"5558";"TypeA8";"2022";"Diesel"

      Thank you