Send file with dynamic file name though tSendmail

Six Stars

Send file with dynamic file name though tSendmail

Hi,

 

Can someone advise me below? Thank you so much!

I am trying to use tSendmail component to send file with current date. I put below in tsendmail file attachment - 

"C:/Users/....../E106_Error_report_"+TalendDate.formatDate("yyyyMMddHHmmss",TalendDate.getCurrentDate())+".US.DWLOGN"

and I got below error - 

Capture.PNG


Accepted Solutions
Forteen Stars TRF
Forteen Stars

Re: Send file with dynamic file name though tSendmail

Regarding the job design, it should looks like this to be clearer:

Capture.png

Now, why it doesn't work, this is the question.

In your 1rst post you said you use TalendDate.formatDate("yyyyMMddHHmmss",TalendDate.getCurrentDate()) to construct the filename in tSendMail.

As "ss" changes every second (!!!) you probably have a different filename between tFileOutputDelimited and tSendMail.

To avoid this kind of mistake, I suggest you to use a global or context variable to define the filename and filepath.

 


TRF

All Replies
Forteen Stars TRF
Forteen Stars

Re: Send file with dynamic file name though tSendmail

Are you sure the file exists before you try to send it? Can you share your job design?

TRF
Six Stars

Re: Send file with dynamic file name though tSendmail

Hi,

 

Please see below. I successfully run the report but not good through tsendmail component

Capture.PNG

Four Stars

Re: Send file with dynamic file name though tSendmail

The E106_US is the file you are attempting to send via email correct? IF so. Connect the tsendmail to the E106_US file Use a OnSub or ONComp to connect. 

Forteen Stars TRF
Forteen Stars

Re: Send file with dynamic file name though tSendmail

Regarding the job design, it should looks like this to be clearer:

Capture.png

Now, why it doesn't work, this is the question.

In your 1rst post you said you use TalendDate.formatDate("yyyyMMddHHmmss",TalendDate.getCurrentDate()) to construct the filename in tSendMail.

As "ss" changes every second (!!!) you probably have a different filename between tFileOutputDelimited and tSendMail.

To avoid this kind of mistake, I suggest you to use a global or context variable to define the filename and filepath.

 


TRF
Six Stars

Re: Send file with dynamic file name though tSendmail

Thanks! Your advice is very helpful! - after I delete "ss" and tsendmail worked.

I am also learning on creating global variable/context variable. Can you please educate me what global variable means? can't find explanation and not know how to do 

Forteen Stars TRF
Forteen Stars

Re: Send file with dynamic file name though tSendmail