Five Stars

How to create batch header and trailer records in output file

Hi,

 

How to create Batch header and trailer with detail records

Input is single file for example

ID,Name1,Name2

10,a1,a2

10,b1,b2

20,c1,c2

20,d1,d2

20,e1,e2

 

Output be like

B10

Da1a2

Db1b2

T10

B20

DC1C2

Dd1d2

De1e2

T20

 

How can we achieve this? Please help

Thanks in advance

2 ACCEPTED SOLUTIONS

Accepted Solutions
Fifteen Stars

Re: How to create batch header and trailer records in output file

I'm assuming the batches are identified by the ID. If that is the case, this is relatively easy. However, it is a little complicated to explain quickly and I do not have a great deal of time right now. So I have knocked up an example (it's quicker to do than explain) in v6.5.1. Take a look at this and see if you can work with it. You may need to download Talend 6.5.1 to use this if you aren't using that version.

Rilhia Solutions
Fifteen Stars

Re: How to create batch header and trailer records in output file

You can do this with a tAggregateRow component. I believe you can just add the calculation (count) into one of the ones I put into the job....I don't have it here at the moment and am not using 6.5 so I can't look at it.

Rilhia Solutions
4 REPLIES
Fifteen Stars

Re: How to create batch header and trailer records in output file

I'm assuming the batches are identified by the ID. If that is the case, this is relatively easy. However, it is a little complicated to explain quickly and I do not have a great deal of time right now. So I have knocked up an example (it's quicker to do than explain) in v6.5.1. Take a look at this and see if you can work with it. You may need to download Talend 6.5.1 to use this if you aren't using that version.

Rilhia Solutions
Five Stars

Re: How to create batch header and trailer records in output file

THANK YOU SO MUCH. It is working. Thanks alot.

is there any way to get Count of number of records per each group to append to Trailer Record for every batch?

 

 

 

 

Thanks in advance

Fifteen Stars

Re: How to create batch header and trailer records in output file

You can do this with a tAggregateRow component. I believe you can just add the calculation (count) into one of the ones I put into the job....I don't have it here at the moment and am not using 6.5 so I can't look at it.

Rilhia Solutions
Five Stars

Re: How to create batch header and trailer records in output file

Thanks alot. Thank you for the help!