Tsendmail - not want to send empty file to receiver

Highlighted
Six Stars

Tsendmail - not want to send empty file to receiver

Hi,

 

I am using tsendmail to send email with attachment report. But I realized that sometimes there is no data contained in the attachment report - so I am trying to find a way to not send empty file. I checked "don't send empty file" setting in my output component and I also unchecked the "die if attachment not exist" in tsendmail component. However, for below job, I will still receive email but with no attachment in my local server. what I want is to not send the email if the attachment file is empty.

If I still check "die if attachment not exist" I will get the error and the job will stop running. Usually A file is empty.

Can you please help me on this issue? Thanks so much!

 

Capture.JPG


Accepted Solutions
Six Stars

Re: Tsendmail - not want to send empty file to receiver

Hi,

Thank you for your reply. I just figured out a simple way to achieve my thought -

In output, go to component tab -> Advanced setting -> check "don't generate empty file"
In tSendmail component, check "Die if file doesn't exist" and then uncheck "Die if error"
In this way my job will run successfully without empty file.

View solution in original post


All Replies
Employee

Re: Tsendmail - not want to send empty file to receiver

Hi,

 

     Could you please try in slightly different way as shown below?

 

      Allow the first subjob to put all the data to your output delimited files.

 

       Verify the NB_LINE value for each file and add this condition as not equal to zero in condition check of run if.

 

        Once you click the NB_LINE value, the value for each file will get converted as below.

 ((Integer)globalMap.get("tFileOutputDelimited_1_NB_LINE")) !=0

      

        If there are zero records, the control will not go to the tsendmail component.

 

image.png

 

 

Hope the reply has helped your query. Could you please mark the topic as resolved, if it has helped to close your query? Kudos are also welcome :-)

 

Warm Regards,

 

Nikhil Thampi

Six Stars

Re: Tsendmail - not want to send empty file to receiver

Hi,

Thank you for your reply. I just figured out a simple way to achieve my thought -

In output, go to component tab -> Advanced setting -> check "don't generate empty file"
In tSendmail component, check "Die if file doesn't exist" and then uncheck "Die if error"
In this way my job will run successfully without empty file.

View solution in original post

Employee

Re: Tsendmail - not want to send empty file to receiver

Hi,

 

     That is awesome news. There are always multiple ways to arrive at solution for same problem.

 

      Could you please mark the topic as resolved so that it will help our fellow Talend community members?

 

Warm Regards,

 

Nikhil Thampi

 

2019 GARTNER 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

Best Practices for Using Context Variables with Talend – Part 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog