Integration

Get Involved. Join the Conversation.

Topic

    Cesar Tepetla Corte
    Error using stage file with the action: Zip Files
    Topic posted May 28, 2019 by Cesar Tepetla CorteBronze Medal: 1,250+ Points, tagged Connection, Database, Integration, Mapping, Process, xml 
    70 Views, 3 Comments
    Title:
    Error using stage file with the action: Zip Files
    Summary:
    Error using stage file with the action: Zip Files
    Content:

    I'm working on an integration that reads a list of files and for each one generates a .dat file and compresses in .zip the steps of the integration are the following:

    1. I make a query Select an external table to list files from an SFTP1 directory.
    2. I have created a For Each cycle to go through each file name.
    3. Within the For Each cycle, I send a stored procedure to read a file that receives the name of the For Each position that it is traveling.
    4. I use a stage file object with the Write File operation to create the .dat file.
    5. I use a stage file object with the Zip File operation to compress the .dat file created in the previous step.

    After doing all these steps I write the content of Stage Zip on another SFTP2 server, but they are created in an inappropriate way for example if I am processing three files the result would be the following:

    FilzeZip1.zip contains:
    file1.dat

    FilzeZip2.zip contains:
    file1.dat and file2.dat

    FilzeZip3.zip contains:
    file1.dat, file2.dat and file3.dat

    And this should not be the case every .dat file must be compressed in a single .zip file
    Does anyone have an idea why this happens?
    I appreciate your comments and opinions.

    Regards.

    Comment

     

    • Sharmistha Ghosh

      Try below -

      1. Generate all .dat files under one single folder.

      2. Use FTP adapter to List the files.

      3. Use ForEach loop [Repeating Element --> output of List (File collection Element) ] 

      4. Then, using FTP adapter [Operation:  DownloadToICS] download all files under ics temporary folder e.g. /temp [under ForEach loop]

      5. Use Stage Activity to zip the file [* Specify the Directory to zip = /temp] [Outside ForEach loop]

      6. Then, you can use FTP [operation: Write File] to write zip to SFTP location. [Map FileReference from Zip Response to  FileReference of Write File Request]

      Above will zip all .dat files into one zip file. Don't worry about the structure. Zip will not contain any folder but .dat files.Try and let us know.

    • Mani

      Move the stage file activity (zip operation) outside of the for each loop

    • Monish Munot

      Cesar,

      1. Move zip action after the for loop.
      2. Use FTP Adapter with Write operation to move the file to ftp/sftp server using file reference.

      This should resolve the issue.