.zip file transferring as post and saving with additional label.

Five Stars

.zip file transferring as post and saving with additional label.

Hi All,

 

I have rest service, I am sending .zip file to it with post request and which consumes multipart. I am able to see the content once i hit the service. But i want to save the .zip with additional labels.[labels will be send as additional parameters to the request]. if .zip is x.zip i want to save it as x_y.zip. 

 

I tried it with FileOutputRaw. but i cant dynamically add y variable.


Accepted Solutions
Highlighted
Community Manager

Re: .zip file transferring as post and saving with additional label.

This is just a timing issue. After you have received your data, don't immediately write it to a file (using the tFileOutputRaaw). Instead, calculate your parameters and work out your filename, then pass the data to a tFlowToIterate. Connect that (like in your screenshot) to a tFixedFlowInput. Your data will be stored in a globalMap variable. Retrieve that globalMap variable and use it in the tFixedFlowInput for your raw file data (I'm assuming it is stored as an Object). Then connect this to your tFileOutputRaw and use the filename calculated (also stored as a globalMap).

 

The reason this is causing you an issue is that as soon as the subjob is started, the filename of a tFileOutput component, is set. So if you are calculating the name in the subjob, it won't work. If you use the iterate link (as described) it essentially starts a new subjob. If the value of the filename is known by that point, it will work.


All Replies
Highlighted
Community Manager

Re: .zip file transferring as post and saving with additional label.

This is just a timing issue. After you have received your data, don't immediately write it to a file (using the tFileOutputRaaw). Instead, calculate your parameters and work out your filename, then pass the data to a tFlowToIterate. Connect that (like in your screenshot) to a tFixedFlowInput. Your data will be stored in a globalMap variable. Retrieve that globalMap variable and use it in the tFixedFlowInput for your raw file data (I'm assuming it is stored as an Object). Then connect this to your tFileOutputRaw and use the filename calculated (also stored as a globalMap).

 

The reason this is causing you an issue is that as soon as the subjob is started, the filename of a tFileOutput component, is set. So if you are calculating the name in the subjob, it won't work. If you use the iterate link (as described) it essentially starts a new subjob. If the value of the filename is known by that point, it will work.

Five Stars

Re: .zip file transferring as post and saving with additional label.

Thank you so much  Smiley Happy

Community Manager

Re: .zip file transferring as post and saving with additional label.

Not a problem. Glad to help :-)

15TH OCTOBER, COUNTY HALL, LONDON

Join us at the Community Lounge.

Register Now

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

Talend API Designer – Technical Overview

Take a look at this technical overview video of Talend API Designer

Watch Now

Getting Started with APIs

Find out how to get started with APIs

Read