One Star

Reject Handling - best practices

I wonder if someone could tell me if there is a better way to accomplish what I'm trying to do. I'm having trouble specifying a specific reject reason for a data set when a lookup fails in the tMap component (if a tMap contains several lookups and all are inner joins, then there is apparently no way to know which lookup failed and caused the record to be rejected). My solution is to use a series of tMaps and each tMap only contains one lookup - which makes it easy to add a column to the reject output and specify a reject reason : i.e. : "Invalid Customer Number!" when the Customer Number tMap fails.
My solution is to use one tMap component for each lookup. This makes it possible to know why the lookup failed and append a "reject reason" field to the output. I have included a screenshot of the relevant job flow which shows how the data is flowing through a series of tMaps, with a tFileOutput for the rejects. This seems to be a cumbersome way of doing it, and now I have to find a way to merge all of those files back together (tUnite does not work in this case for some reason).
Is it possible to identify which lookup a record failed on in a tMap component which contains several lookups?
Here's an example:
If I have input with three fields:
Customer Number, Customer Type, Region
and I want to perform lookups on all 3 fields so that I can convert each into an ID field (as is normal with referential integrity), like this:
CUSTOMER_ID, TYPE_ID, REGION_ID
Is it possible to do all of this in one tMap AND also to know for example if a record is rejected whether it was rejected due to Invalid Customer Number, Invalid Type, or Invalid Region?
It seems to me like if we do it all in one tMap then when a record is rejected we won't be able to know what was the specific reason that it failed.
Thanks,
Joe
11 REPLIES
Seven Stars

Re: Reject Handling - best practices

tUnite does not work in this case for some reason

Talend does not allow flows to be split and rejoined e.g. two flows originating from one tMap component to be re-united at a tUnite or tFileOutput). However, you could possibly have each output component reference the same file; although that might only work with text files.
Is it possible to do all of this in one tMap AND also to know for example if a record is rejected whether it was rejected due to Invalid Customer Number, Invalid Type, or Invalid Region?

With tMap inner joins, Talend does not attempt any joins after the one that fails. You can thus have all your lookups in one tMap with one table of rejects but with the reason determined by which of the lookup fields have a value and which are null e.g. in Java syntax, assuming the lookup tables are in the order you've given:
CustomerTable.CUSTOMER_ID==null
?"Invalid Customer Number!"
:CustomerTypeTable.TYPE_ID==null
?"Invalid Customer Type!"
:"Invalid Region!"
One Star

Re: Reject Handling - best practices

Thank you, alevy.
One Star

Re: Reject Handling - best practices

Hi

I have created a job with following flow :
tfilelist -->tfileinputdelimited--------->tmap-->tmysqloutptutbulkexec
|reject
|--> tfileoutputdelimited

the data rejected from tfileinputdelimited will be got in tfileoutputdelimited with reason of rejection
The problem is the output file does not contain entire row details,if the row is rejected because of first column data then the output file contains only that field value in the row with reason for rejection . But i want the entire row values data for reloading purpose how to achieve that .
Moderator

Re: Reject Handling - best practices

Hi banu,
What's your expected result and actual result? Why did you use rejects row from tfileinputdelimited instead of tMap? Could you please elaborate your case with an example?
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.
One Star

Re: Reject Handling - best practices

Hi ,

The input file contains some junk value that gets rejected in tfileinputdelimited component only
the rejected file contains below value:
;;;For input string: "slu1a^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@0009102451^@0009109438^@1357050300^@1357051200^@0000006988^@0009102451" - Line: 0

What actually i want is the rejected file should contain entire row values like as follows:
slu1a^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@0009102451^@0009109438^@1357050300^@1357051200^@0000006988^@0009102451;565;767;76 then rejected reason .
Moderator

Re: Reject Handling - best practices

Hi,
What's the rejected reason? Usually, the rejects row from input file can be shown the string (see my screenshot for data type issue).
Best regards
Sarina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: Reject Handling - best practices

hi sabrina,

what i want is ,the data should be written into the file with all the column values not only till the column being rejected ....
Moderator

Re: Reject Handling - best practices

Hi,
So far, the rejects information just show the error string and the location.
For example,
Id;Name;Age;Email
1;shong;11;shong@talend.com
a;elise;22;elise@talend.com
We set Id as "int/integer" and the string "a" will be rejected.
The error message will be : For input string "a"-Line 2 instead of For input string "a;elise;22;elise@talend.com" -Line2.
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.
One Star

Re: Reject Handling - best practices

thx for reply

Re: Reject Handling - best practices

Hi Sabrina,
I'm trying to save the reject data into a table on oracle. But no matter what output that i use, always come back the line with error as primary key. See my example:
I have a table with 3 columns: id, name, email
1NAME 1name1@email.com
 - Line: 0
2NAME 2name1@email.com
 - Line: 1
3NAME 3name1@email.com
 - Line: 2
4NAME 4name1@email.com
 - Line: 3

So, when i tried to save the data, i have an error with ID, because is not a number. What can i do to take it off the line with "Line errors"?
Moderator

Re: Reject Handling - best practices

Hi viniciuscoimbra,
Could you please give us more info about your current job?
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.