Create reject record's excel only if tMAP have any

Five Stars

Create reject record's excel only if tMAP have any

Hello All,

 

I am working on a simple job and I am new to talend. I want to create an excel file from tMAP with rejected records only if tMAP has any rejected records. 

 

I tried following

1. tMAP --main--->tJavaRow-----if trigger (reject_row > 0)------>how to put records from tMAP to excel???

 

Please find my screenshot attached here. 

 

Capture.PNG

 

 

Any help would be great. Thanks in Advance. 

Forteen Stars TRF
Forteen Stars

Re: Create reject record's excel only if tMAP have any

If you want to push rejected record from the join you have into tMap, just tick the option "Catch inner join rejects" for the coresponding outpout (in the tMap editor), then connect this flow to your tFileExcelOutput.

Base on your job design you just have to move the link from tJavaRow_1 to tFileExcelOutput_1.

Or maybe I didn't understand your question???


TRF
Moderator

Re: Create reject record's excel only if tMAP have any

you can capture the rejects in tmap with these settings 1.png

 

to put it into excel you can output it as a csv file using tfileoutputdelimited and setting the field separator as, ","

Five Stars

Re: Create reject record's excel only if tMAP have any

Hello TRF,

 

Thanks a lot for your reply. My issue is that, i want to output rejected excel file only if rejected records are present. That means i want to add run if connection to excel file output when (reject_rows>0). 

 

I am not getting how to check if condition at the same time forward my rejected rows to excelOutput if condition is true. Hope you get me this time.

Five Stars

Re: Create reject record's excel only if tMAP have any

Hello TRF,

 

Thanks a lot for your reply. My issue is that, i want to output rejected excel file only if rejected records are present. That means i want to add run if connection to excel file output when (reject_rows>0). 

 

I am not getting how to check if condition at the same time forward my rejected rows to excelOutput if condition is true. Hope you get me this time.

Twelve Stars

Re: Create reject record's excel only if tMAP have any

@Prerak, I suggest you to create a sequence in tMap for rejected records and then populate rejectes to tFilterRows and check the sequence number greater than 0 then populate to tFilterColumns to remove sequnce coulmn and write tFileOutputExcel ,and in the Advanced settings enable check box Don't generate empty files. and i have shown the design below.

 

Untitled.png

Manohar B
Five Stars

Re: Create reject record's excel only if tMAP have any

Hello Manohar,

 

I like what you have done here, but i am not sure how to achieve "populate rejectes to tFilterRows and check the sequence number greater than 0 then populate to tFilterColumns". 

 

How can i check sequence number greater than 0 in tFIlterRows, also i can not see any if condition in your code. Can please send me component view of your filterRow and filterColumn if possible.

Twelve Stars

Re: Create reject record's excel only if tMAP have any

You need to generate sequence in tmap for rejected section using sequence () function in tMap
Manohar B
Five Stars

Re: Create reject record's excel only if tMAP have any

Hello Guys,

 

I have achieved the said scenario by using following approach

 

Capture.PNG

 

 

 

tMap --> output

tMap-->Rejected records--->tHashoutput--->tJavaRow---> Run if (number of records >0)

tHashInput----->ExcelFile

 

 

In above scenario, the flow will only reach to output an excel file if there are any rejected records.

 

Twelve Stars

Re: Create reject record's excel only if tMAP have any

@Prerak,Did this help you? If so, thank's to mark your case as solved.

Manohar B
Forteen Stars TRF
Forteen Stars

Re: Create reject record's excel only if tMAP have any

@manodwhb, please avoid to copy/paste expressions or answers from other people without mentioning them.

This is not very fairplay.


TRF