Forum Discussion

RoyB's avatar
RoyB
New Contributor III
4 years ago
Solved

Need to create a text file

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

5 Replies

  • Hi Marjan

    That’s worked to create a text file
    (but the CSV Formatter is messing with my format since the field was already formatted, but that is something I can sort out myself)

    Thanks to both of you for the help

  • 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

  • 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

  • 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