Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
Aznrhmn_97
Contributor
Contributor

Need help! How to group by records and send groups of records to child job

Hi everyone, I'm new with Talend Open Studio and still learning. I have some records from input file and I want to group of these records and send to child job. 

 

Here is example of records from input file:

PARENT CHILD
John Sally
John Sarah
Taylor Adam
Taylor Aaron
Taylor Aria
Goh JiaWei

 

What I expect is the data will be send by group of parent, but it send by rows. So here is what I expect :

 

.----------+----------.
|       tLogRow_1     |
|=---------+---------=|
|Parent    |Child     |
|=---------+---------=|
|John      |Sally     |
|John      |Sarah     |
'----------+----------'

.----------+----------.
|       tLogRow_1     |
|=---------+---------=|
|Parent    |Child     |
|=---------+---------=|
|Taylor    |Adam      |
|Taylor    |Aaron     |
|Taylor    |Aria      |
'----------+----------'

.----------+----------.
|       tLogRow_1     |
|=---------+---------=|
|Parent    |Child     |
|=---------+---------=|
|Goh       |Jiawei    |
'----------+----------'

 

 

 

Here what I got:

 

.----------+----------.
|       tLogRow_1     |
|=---------+---------=|
|Parent    |Child     |
|=---------+---------=|
|John      |Sally     |
'----------+----------'

.----------+----------.
|       tLogRow_1     |
|=---------+---------=|
|Parent    |Child     |
|=---------+---------=|
|John      |Sarah     |
'----------+----------'

.----------+----------.
|       tLogRow_1     |
|=---------+---------=|
|Parent    |Child     |
|=---------+---------=|
|Taylor    |Adam      |
'----------+----------'

 

This is how I set to send the records to child job. Figure below is tRunJob setting in parent job

 

0683p000009MZvz.png

 

Here is what I set in context in child job :

0683p000009MaRy.png

 

Can someone help me on how to send a group of records to child job?

Labels (2)
1 Solution

Accepted Solutions
TRF
Champion II
Champion II

You need to aggregate records using tAggregateRow component before to call the child job.

Based on your initial design, it should come after tHashInput.

Set "Group by" on PARENT field, then in "Operations" add a line with CHILD for "Output column" and "List" for "Function".

This will give you PARENT = John and CHILD = Sally,Sarah for the 1rst group and so on.

Finally, in the child job you have to convert CHILD field from list to records to retrieve original dataset.

This could be done using tNormalize component.

View solution in original post

2 Replies
TRF
Champion II
Champion II

You need to aggregate records using tAggregateRow component before to call the child job.

Based on your initial design, it should come after tHashInput.

Set "Group by" on PARENT field, then in "Operations" add a line with CHILD for "Output column" and "List" for "Function".

This will give you PARENT = John and CHILD = Sally,Sarah for the 1rst group and so on.

Finally, in the child job you have to convert CHILD field from list to records to retrieve original dataset.

This could be done using tNormalize component.

Aznrhmn_97
Contributor
Contributor
Author

yeay, thank you