Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

tFTPPut using variables

Hi,

 

I am trying to move files from a local directory to an SFTP server using the tFTPPut component.

 

Since there are many files (and they are coming from various locations) I am using variables to specify the local directory, the remote directory, filemask and new name as shown below.

 

0683p000009LvHY.png

This results in a "file name invalid!" error message being displayed when executing the job for a single file.

 

However when I provide literal values (taken from the variables) then the job runs correctly and places the file on the SFTP server location such as the setup below.

 

0683p000009LvCo.png

Please let me know if there is something wrong with my setup & is it possible to use the variables to specify the local directory, filemask & new name?

 

Thanks

Labels (1)
1 Solution

Accepted Solutions
TRF
Champion II
Champion II

Hi,

 

Are you sure the row3 fields are all populated?

If yes, I suggest you to use global variables instead of row field.

You can use tFlowToIterate before to genrate the required variables.

Also, can you share a screenshot for the complete job design?

View solution in original post

8 Replies
TRF
Champion II
Champion II

Hi,

 

Are you sure the row3 fields are all populated?

If yes, I suggest you to use global variables instead of row field.

You can use tFlowToIterate before to genrate the required variables.

Also, can you share a screenshot for the complete job design?

Anonymous
Not applicable
Author

I believe this is probably because of the same reason you cannot select a file to write to from a flow. This is an irritating "feature" of Talend, but easy to get round. Instead of using your row variables, connect the component before teh ftp component to a tFlowToIterate component. This will put all of the columns into a globalMap HashMap. You can access the variables as below.....

globalMap.get("row.column")

"row" and "column" correspond to your row name (feeding into the component) and column name. 

 

If you connect your tFlowToIterate component to your FTP component using an Interate link, then you can use the variables stored in the globalMap.

 

If you are familiar with Java you will know you will need to cast these variables. If you are not, basically you will need to change the class type they refer to. To simplify this just think about the Column Type in the schema. If it says String you will need to use the following code....

((String)globalMap.get("row.column))
Anonymous
Not applicable
Author

Seems I essentially put what @TRF put. Sorry mate, I left this open ready to comment and then got sidetracked with some fo my actual work. Ended up filling it in later and then saw yours 🙂

TRF
Champion II
Champion II

@zsiddiqi, with my post you got the idea, with @rhall post, you got the details 0683p000009MA9p.png

Anonymous
Not applicable
Author

Thanks @TRF @rhall

 

I tried it with tFlowToIterate and that solved all my problems. I didn't have to use global variables either

TRF
Champion II
Champion II

@zsiddiqi very strange!!!

Can you share your job design?

Anonymous
Not applicable
Author

I think that is a lucky timing quirk @TRF. While the tFlowToIterate is processing the following iterating, the row variables used may still hold valid values. But the globalMap values should be used to be safe in my opinion.

TRF
Champion II
Champion II

@zsiddiqi I agree with @rhall, you should use the global variables.