Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Compare current row with previous row based on some condition in excel file in talend

Hi

I am creating a job which take input from db and insert in excel file sheet. I want to compare current row with the previous row in excel and get unmatched row copied in to another file. Is that comparing possible?

 

If yes, Please help me in doing that.

If no, How can I achieve this in alternate way.

 

Thanks in advance.

 

Meghana.

Labels (2)
1 Solution

Accepted Solutions
SachinD
Creator
Creator

Yes @aashish you are correct,

we can achive it using tMemorizeRow , but one need to write custom Java code in tJava components.

 

tMap can keep values between rows and its process from top to bottom order. we can configure to hold the last value of particular columns and compare them with the current row column.

 

yes you are right if we want to keep more than 2 rows in memory we can use tMemorizeRow, as it can be configured to keep n number of rows in memory.


its also possible with tMap, by increasing no of variables.

we can pick any logic as per our complexity.

 

 

Thanks,

Sachin D

 

View solution in original post

4 Replies
SachinD
Creator
Creator

Hi @MeghanaKottala

 

Yes, it can be done using tMap, by keeping previous row column values in variable.

if you want to compare multiple columns with previous rows, you need to add more variables.

 

I my example i have just compared ID column, you can take more columns if needed.

and add some more logic as per your requirement.

 

 

0683p000009Lzg0.jpg0683p000009Lzk6.jpg0683p000009LzkB.jpg

 

click Accept the solution if it helps, 
Also kudos are welcome 0683p000009MACn.png

 

Sachin.

aashish_21nov
Creator
Creator

Hi @MeghanaKottala,

 

Appreciate your efforts @SachinD but tMemorizeRow is the component to compare data with previous row.

SachinD
Creator
Creator

Yes @aashish you are correct,

we can achive it using tMemorizeRow , but one need to write custom Java code in tJava components.

 

tMap can keep values between rows and its process from top to bottom order. we can configure to hold the last value of particular columns and compare them with the current row column.

 

yes you are right if we want to keep more than 2 rows in memory we can use tMemorizeRow, as it can be configured to keep n number of rows in memory.


its also possible with tMap, by increasing no of variables.

we can pick any logic as per our complexity.

 

 

Thanks,

Sachin D

 

Anonymous
Not applicable
Author

Thanks for the response.

 

I have used tJava component and stored previous value as context variabe as I need only one value to remember. It's working fine. 

 

Thanks,

Meghana.