One Star

Handling Database Rejected Rows on Error.

Hi,
What is the best way to handle and send an email with Rejected Rows on Error for tOracleOutput Component?
And 
How to send RowsOnError as attachment?
How to send RowsOnError as Email Message body?
Can we raise an warn message and catch that warn and send an email?If so how transform Rejects to twarn?
Please let me know how to build it.
Appreciate your Help.
KK
2 REPLIES
Moderator

Re: Handling Database Rejected Rows on Error.

Hi,

  
The 'Die on error' option can not be used with reject link together, if you want to use reject link, the 'die on error' option should be unchecked. You can send an email if the some rows are rejected. For example:
....tOracleOutput--reject--tFileOutputDelimited--runIf--tSendMail        
 It outputs the rejected rows to a file, this file can be attached in the mail  if needed,
set the condition of runIf as:
((Integer)globalMap.get("tFileOutputDelimited_1_NB_LINE"))>0
If you want to send rejects rows as email Message body, you should pass rejects rows into context value by using tJavaRow firstly, and then getting the context value in Message body of tSendMail.
Here is a related forum for this scenario, please refer to:https://www.talendforge.org/forum/viewtopic.php?id=40323
Feel free to let us know if it is OK with you.
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.
Five Stars

Re: Handling Database Rejected Rows on Error.

Unless the reject file is so large that it would be impractical to Email it, I always send it as an attachment (.csv) which is more useful than having it in the Email body.