Detecting file not found with tFTPGet

Five Stars

Detecting file not found with tFTPGet

Hi,

I have a job that tries to pick up a file from our sftp site every morning. I would like to detect if the file is missing.

The tFTPGet onSubJobOK connects to a fileInputDelimited component. As long as the file is there, it works fine.

 

I connected a tSendMail component that is connected to the OnComponentError of the tFTPGet and should send the error via email using ((String)globalMap.get("tFTPGet_1_ERROR_MESSAGE"))

 

Unfortunately, when I run the job and the file is missing, it always seems to return OK not error (even though I can see the job returning "the system can't file the file specified".)

 

Any idea what I'm doing wrong?

 

TIA.

 

 


Accepted Solutions
Highlighted
Seven Stars

Re: Detecting file not found with tFTPGet

"OnComponentError" will only trigger if the component itself fails (e.g. the connection to the ftp site gets closed, or something along those lines). Even though that file was not found, the component still executed successfully. If you're looking to see if a specific file name was processed, you could use the tFTPFileExist component, then check the global var ((Boolean)globalMap.get("tFTPFileExist_1_EXISTS"))


All Replies
Highlighted
Seven Stars

Re: Detecting file not found with tFTPGet

"OnComponentError" will only trigger if the component itself fails (e.g. the connection to the ftp site gets closed, or something along those lines). Even though that file was not found, the component still executed successfully. If you're looking to see if a specific file name was processed, you could use the tFTPFileExist component, then check the global var ((Boolean)globalMap.get("tFTPFileExist_1_EXISTS"))

Five Stars

Re: Detecting file not found with tFTPGet

Ah, OK. That makes sense. Thank you I'll try your suggestion.

Ten Stars

Re: Detecting file not found with tFTPGet

Alternately, you can create a conditional (Run If) link from tFTPGet with a condition like:
((Integer)globalMap.get("tFTPGet_1_NB_FILE")) == 0
Five Stars

Re: Detecting file not found with tFTPGet

Thanks, the first solution got the job done, but I'll keep that in mind.

Eight Stars

Re: Detecting file not found with tFTPGet

Please mark the solution as accepted whichever helped u