How to send data one after another to three tables in cyclic order in talend?

Six Stars

How to send data one after another to three tables in cyclic order in talend?

I have one source table,the data in source table is like,

Capture1.JPG

I have 3 target tables T1,T2 and T3. I want the output as follows,

The data in T1 should be,

 

Capture2.JPG

The data in T2 should be,

Capture3.JPG

The data in T3 should be,

Capture4.JPG

 

How an i Achieve that in talend?

Note: I am using Mysql database.


Accepted Solutions
Sixteen Stars

Re: How to send data one after another to three tables in cyclic order in talend?

Connect your data to a tMap with 3 outputs. Create an integer tMap variable with a sequence generator....

 

routines.Numeric.sequence("seq", 1, 1)

In each of your outputs use a filter with following logic....

 

Table1

Var.seq%3==1

Table2

Var.seq%3==2

Table3

Var.seq%3==0

This is using a modulus operator which will return 1 when a number is not divisible by 3 and has a remainder of 1, 2 when a number is not divisible by 3 and has a remainder of 2 and 0 when the number is divisible by 3. This will allow you to cycle your outputs as you wish 


All Replies
Sixteen Stars

Re: How to send data one after another to three tables in cyclic order in talend?

Connect your data to a tMap with 3 outputs. Create an integer tMap variable with a sequence generator....

 

routines.Numeric.sequence("seq", 1, 1)

In each of your outputs use a filter with following logic....

 

Table1

Var.seq%3==1

Table2

Var.seq%3==2

Table3

Var.seq%3==0

This is using a modulus operator which will return 1 when a number is not divisible by 3 and has a remainder of 1, 2 when a number is not divisible by 3 and has a remainder of 2 and 0 when the number is divisible by 3. This will allow you to cycle your outputs as you wish 

Forteen Stars TRF
Forteen Stars

Re: How to send data one after another to three tables in cyclic order in talend?

Forgot this post.


TRF