Forum Discussion

cbot412's avatar
cbot412
New Contributor II
2 years ago
Solved

Line Break in Mapper

 

I have this below code, but the output csv contains \n instead of giving line break

$id + '\n' + $crse_detail.toString().replace(/;/g, '\t\t').replace(/,/g, '\n') + '\n' + '**********' + '\n'

I tried updating the csv formatter delimiter to \n. It errored out saying line break can not be a delimiter.

Any suggestions?

  • I am guessing you do not actually want a csv output but some sort of text file, based on that the content should be separate lines and then each block separated with the stars?
    If you have some other challenge please provide some sample input and maybe a mockup on what you expect out..

    I think you will only need to map the line as in your code above but in order to output the text with line breaks you can join all lines with \n and then push it as binary out to a file. 
    I have attached a sample for you to test with..

2 Replies

  • endor_force's avatar
    endor_force
    New Contributor III

    I am guessing you do not actually want a csv output but some sort of text file, based on that the content should be separate lines and then each block separated with the stars?
    If you have some other challenge please provide some sample input and maybe a mockup on what you expect out..

    I think you will only need to map the line as in your code above but in order to output the text with line breaks you can join all lines with \n and then push it as binary out to a file. 
    I have attached a sample for you to test with..

    • cbot412's avatar
      cbot412
      New Contributor II

      THANK YOU SO MUCH!!! This worked great!