[resolved] Configuring tFTPPut to upload exactly one input file with Open Studio

One Star

[resolved] Configuring tFTPPut to upload exactly one input file with Open Studio

I am new to Talend Open Studio, and am faced with this problem, and hoped someone could give me some advice. (Maybe my approach is wrong?)
I am trying to FTP a file, which was found using tWaitForFile, to an FTP site. The tWaitForFile component is configured to only pass a created file into the workflow. How should I configure the tFTPPut component to submit only the file from the tWaitForFile component? I have tried to set the FileMask on the tFTPPut component to the file name, however this did not work. I uploaded my flow that I tried to use in a screenshot. When I try to run it, it gives a "file name invalid!" error on the run console. 
I am using Talend Open Studio for ESB, version 5.5.
Four Stars

Re: [resolved] Configuring tFTPPut to upload exactly one input file with Open Studio

Hi,
Wait for file variable used returns only the file name and what about the file path?....try using System.out.println(filenamevariable); to confirm the file name... for tFTPPut component, you also need directory path... if directory path is not available, then it looks for file inside root location of talend....  In tFTPPut component, you will have to concatenate the directory path for corresponding file or use complete path of the file...
Vaibhav
One Star

Re: [resolved] Configuring tFTPPut to upload exactly one input file with Open Studio

Hi Viabhav
I tried entering the full file path by using ((String)globalMap.get("tWaitForFile_1_CREATED_FILE")). I also checked that the full path is returned by running it through a tJavaRow and printing out the value of ((String)globalMap.get("tWaitForFile_1_CREATED_FILE")) to verify that the path is included. Unfortunately this did not work. What did work was to specify the file filter, ie. *.csv. I think that maybe the GLOB filter cannot be set dynamically. I decided to change my job to run on a scheduler instead, and then picking up and transferring all files with that extension. I think this should work.
Thanks,
Wikus
Four Stars

Re: [resolved] Configuring tFTPPut to upload exactly one input file with Open Studio

Hi Wikus,
This is good that you found out an issue.. basically filter also works on complete file name as well... But, it is great that you found out a way to resolve issue.
Thanks
Vaibhav
One Star

Re: [resolved] Configuring tFTPPut to upload exactly one input file with Open Studio

This is an old post, however I thought I will just add my solution here for others: I found out about the pre- and post- job events. It seems that when you set config settings in the pre- and post- jobs and store them in globalMap, they become available in the FTP Put component, and it will work.
-W.
Moderator

Re: [resolved] Configuring tFTPPut to upload exactly one input file with Open Studio

Hi WCoetser,
Thanks for sharing your soultion on forum. Would you mind clicking the "Set this topic as resolved" link which is right underneath your initial post? This way, other users will be informed that this thread has been resolved.

Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.