02-28-2022 02:41 AM
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
Solved! Go to Solution.
02-28-2022 05:43 AM
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
BR,
Marjan
02-28-2022 03:02 AM
Hi @RoyB
Yes, there is a way.
With use of Document to Binary snap.
All data that need be inside of the file, you should map it in content field.
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.
Here is the result.
Regards,
Viktor
02-28-2022 03:29 AM
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
02-28-2022 05:43 AM
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
BR,
Marjan
02-28-2022 05:43 AM
Just to clarify, the sql execute returns thousands of rows that need to go into 1 text document
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