Forum Discussion

spunyala's avatar
spunyala
New Contributor
7 years ago

To add Header & Trailer records

Hi,
I have a requirement to add header and trailer records to a text file before writing to a server.

Can any one guide me how to achieve this functionality.

Thanks,

5 Replies

  • Supratim's avatar
    Supratim
    Contributor III

    @spunyala use copy snap then connect header snap in one output view and use tail to another outputview of copy. Then use union snap and write to a file.

  • tstack's avatar
    tstack
    Former Employee

    Can you give a concrete example of what you’re trying to do? Do you have a FileReader snap that is reading the text file and then you want to add the header and trailer around the stream? For example, if the text file contained:

    Hello, World!

    You want the output to look like the following:

    BEGIN Header
    Hello, World!
    END Trailer

    How big is the file?

  • spunyala's avatar
    spunyala
    New Contributor

    Hi ,

    I am reading the data into text file from Successfactors and writing to the server.
    So i need to write the data as below.
    H(Header) which contains xxxx|yyyy|current date
    Data records …
    T(Tail record) which contains xxxx|total data records count

    Thanks,

    • spunyala's avatar
      spunyala
      New Contributor

      Reading the data from file reader, doing some data conversions, using CSV formatter and writing it to the file with file writer