Chain Loop in Data Integration

Six Stars

Chain Loop in Data Integration

Hi

I have data like this

 

id        subid

23
35
410
57
78
89
1011
1115

 

I need output like this

 

Col1          Col2

23
35
57
78
89
410
1011
1115

 

Here subid of 2 is 3 then 3 will become id i need to get subid of 3 is 5 then this loop should close 

 

2--3

3--5

5--7

7--8

8--9

 

then next data 4

 

4--10

10--11

11--15

 

I want to do in Talend , what is the approach and which components need to use

 

If you need any clarification please comment 

 

Thanks in Advance 

Ten Stars

Re: Chain Loop in Data Integration

What is your input type, database or file or ... ?
In database engines (Oracle) there's functionality to work with parent child:
CONNECT_BY_ROOT and is called hierarchical queries.
in java take a closer look, java doesnt have something build in so you have to do it yourself:
https://www.javagists.com/java-tree-data-structure
Nine Stars

Re: Chain Loop in Data Integration

Hi Ravisankar,

 

Is there any other example? because for the above example if you sort data based on column 2 then data will be as expected out.

 

Regards,

Veeru Boppudi
Ten Stars

Re: Chain Loop in Data Integration

@vboppudi, no it wont...
parent child
1, 3
3, 7
4, 8
7, 12
8, 13
Take a closer look Smiley Wink
Nine Stars

Re: Chain Loop in Data Integration

This is the source data correct?

id        subid

23
35
410
57
78
89
1011
1115

 

Regards,

Veeru Boppudi
Six Stars

Re: Chain Loop in Data Integration

Hi

 

Thanks for response

 

Sorry for the delay

 

Yes @vboppudi, its source data only

 

As @Dijke mentioned, its parent child only

 

example take record

parent  child

2             3

 

here 3 is child but 3 is in parent also and child is 5

 

Its like Self join and loop

 

2 loop is ending on 9

 

I need output like this

 

Col1          Col2

23
35
57
78
89
410
1011
1115

 

Regards

Ravisankar

 

 

 

 

2019 GARTNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog