Four Stars

Reg. data compare and conditional flow

Hi,

 

I have below scenario, I want to compare the output of tUniqueRow and accordingly either run A or B. Any suggestion how should I go about it.

 

Brgds,

Sudhir

ConditionalFlow.png

1 ACCEPTED SOLUTION

Accepted Solutions
Six Stars

Re: Reg. data compare and conditional flow

Hi,

 

tfilecount is not necessary as the tuniquerow gives you the number of unique rows by a global variable. 

 

I am able to see a tfilelist component at the front.

Are you going to use multiple files? 

 

If just one file it is simple.

 

1. Create a tjava 

2. Take a subjob ok from tfilelist component and connect to tjava. Nothing required inside tjava

3. From tjava create 2 runif connector and connect to process a and b

4. ((Integer)globalMap.get("tUniqRow_1_NB_UNIQUES"))  and ((Integer)globalMap.get("tUniqRow_2_NB_UNIQUES"))is the global variable to get the unique number of rows  from both the filters

5. each run if you can use the above variables to do a comparison 

 

For multiple files, I am still thinking how we can go about it. give it a try by following all steps above and taking componentok from tfileinput delimited. 

 

Cheers!
Gatha

7 REPLIES
Community Manager

Re: Reg. data compare and conditional flow

Hello
Basically, we will use runIf connector to fire a subjob base on a condition, but now I don't know what your data comparison logic. Please give us some example data out of tUniqRow1 and tUniqRow2 to explain your logic.

Regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
Four Stars

Re: Reg. data compare and conditional flow

I need to get count of rows in both tUnique and compare it, if both count
matches it should trigger A or else B
Four Stars

Re: Reg. data compare and conditional flow


shong wrote:
Hello
Basically, we will use runIf connector to fire a subjob base on a condition, but now I don't know what your data comparison logic. Please give us some example data out of tUniqRow1 and tUniqRow2 to explain your logic.

Regards
Shong

something like this, though I am not sure if this is the best way to implement this. If you can let me know how to compare o/p of two tfilerowcountsConditionalFlow.png

Six Stars

Re: Reg. data compare and conditional flow

Hi,

 

tfilecount is not necessary as the tuniquerow gives you the number of unique rows by a global variable. 

 

I am able to see a tfilelist component at the front.

Are you going to use multiple files? 

 

If just one file it is simple.

 

1. Create a tjava 

2. Take a subjob ok from tfilelist component and connect to tjava. Nothing required inside tjava

3. From tjava create 2 runif connector and connect to process a and b

4. ((Integer)globalMap.get("tUniqRow_1_NB_UNIQUES"))  and ((Integer)globalMap.get("tUniqRow_2_NB_UNIQUES"))is the global variable to get the unique number of rows  from both the filters

5. each run if you can use the above variables to do a comparison 

 

For multiple files, I am still thinking how we can go about it. give it a try by following all steps above and taking componentok from tfileinput delimited. 

 

Cheers!
Gatha

Four Stars

Re: Reg. data compare and conditional flow

Thanks, I will try this option.

Four Stars

Re: Reg. data compare and conditional flow

Thanks Gatha ! I could do it and its working for multiple files too. Have a look.

 

ConditionalFlow.png

Six Stars

Re: Reg. data compare and conditional flow

That's cool.

 

Please test this with more number of records in the file. 

 

Please mark my previous comment as solution and give Kudos where ever necessary 

 

Cheers!

Gatha