cancel
Showing results for 
Search instead for 
Did you mean: 

Need to create a text file

RoyB
New Contributor III

Hi

We need to create a text file to send to a third party, but snaplogic does not appear to have the ability to create a text file

I’ve had look at online, and only found 1 post that said to export it into a txt file you need to use a csv formatter

Tried this, and the file in snaplogic manager says ABC.txt, but when I download it, its ABC.csv

Is there a way to create a text document with Snaplogic?

I’ve created a view that creates the lines for the file, already in CSV format, and all I want to do is save that to a txt file

Thanks

1 ACCEPTED SOLUTION

Hi @RoyB ,

I have attached sample pipeline, please try it and let me know if it helps you.

CSV to TXT pipeline_2022_02_28.slp (8.4 KB)

The thing is that in the “Mapper” we set content-type to text/plain in order to save the file as .txt
image

BR,
Marjan

View solution in original post

5 REPLIES 5

viktor_n
Contributor II

Hi @RoyB

Yes, there is a way.

With use of Document to Binary snap.
image

All data that need be inside of the file, you should map it in content field.
image

Inside of Document to Binary, set field Encode or Decode to be NONE

And in File Writer along with the name of the file you also need to specify the format.
image

Here is the result.
image

Regards,
Viktor

RoyB
New Contributor III

I’ve made that change, and althought it does create the text file, it only has 1 row in it, which I tracked to the 62nd row in the output.

I suspect it creates the document with the first row, then overwrites each row after that

Any suggestions?
Thanks

Hi @RoyB ,

I have attached sample pipeline, please try it and let me know if it helps you.

CSV to TXT pipeline_2022_02_28.slp (8.4 KB)

The thing is that in the “Mapper” we set content-type to text/plain in order to save the file as .txt
image

BR,
Marjan

RoyB
New Contributor III

Just to clarify, the sql execute returns thousands of rows that need to go into 1 text document
image

I think that the DOCUMENT TO BINARY snap is writing 1 file per row, but because its the same file name, it just overwrites it

I tried rewriting my code to produce only 1 row, but its more characters than allowed, so it just ends up eventually cutting the data off in the middle of one of the rows