
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Trigger mail only if Attachment is not empty
Hi All,
I need to send a mail only when the attachment is having values. If the attachment is empty, i should skip sending mail. I checked advance setting of tSendMail and found no options to do so. one option that comes to my mind is to load the output to a table and take count of the table and do a workaround.
is there any other option in talend??

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
got the "if" condition component tab.
is the code correct?? or any java like code should be given here??

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can check the if based on the global variable. It will be more appropriate.
Warm Regards,
Nikhil Thampi

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thanks a lot to both of you. All ideas of yours are working. but problem in my side is,
the file size is not getting low if the data is available or not.
Actually, if the output is zero, only the "headers" will be available in the output file and size is 4kb.
If 4 rows are returned, then too the the size is 4kb. Only when 5 rows are returned, then i get size as 5kb.
I tried below option:
Select "Don't generate empty file" in the output file and
Select "Die if attachment file does not exist" in tSendMail.
Since i am using tLogCatcher, I will not be able to use above two options either.
any other options you both have other than checking file size or any ways??

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@joe86,better to go with .txt or .csv file,so you can easily,identify the file size.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
as told, i took another output as ".csv" file (just to check the size of my output file) and gave the flow as below:
and in tSetGlobalVar, i gave Key as "K1" and value as "row2.size". And in the "if" component I gave as "globalMap.get("K1") > 0".
But i got error as below:
"The operator > is undefined for the argument type(s) Object,int"
can you please help me on this fix??
Note: The tLogRow jobs are given just to check if the tSetGlobalVar produces output as required.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
got below error:
below is the value given in tSetGlobalVar:
is this correct? Not sure, where am i making wrong.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@joe86,row2.size not needed in single or double quotes.
