Four Stars

How to compare values between two data files

Hi guys,

 

I am trying to compare values between two excel files in talend but not too sure how to do it.

I need to compare if the total number of records in file A is equal to a cell with the sum value in file B. Based on this result i need to run a job to insert records into Salesforce.

Does anyone have an idea how the comparison between 2 data files can be done?

 

 

5 REPLIES
Employee

Re: How to compare values between two data files

Read all records from file A with tFileExcelInput component, then use tAggregate to count the number of rows.  Send the number of rows into a tMap.  On your tMap, lookup the value in file B.  Compare the 2.  And then carry on from there.

 

There is a possibility here to use data preparation, and recipes in Data Prep.  But it will depend on your data and what your logic is.

Employee

Re: How to compare values between two data files

Refer attached job which will do what you are expecting.

 

1) Below flow is just for logging

 

compare_Values_1.JPG

 

 

2) Change tlog (matched) with your salesforce output to write into salesforce

 

 

compare_Values_2.JPG

 

 

Four Stars

Re: How to compare values between two data files

Hi thanks guys.  @sjain & @iburtally

 

I tried using @sjain's flow. however im having trouble with the tMap.

I need to count the number of rows in a particular column of inputExcel1 and check if it matches the value of in a particular cell (B3) in inputExcel2. 

Any idea how the mapping/expression can be defined? 

 

 

 

Employee

Re: How to compare values between two data files

Hi,

 

Use taggregator to count the records as explain in my job & then use tmap for comparison or join.. 

Employee

Re: How to compare values between two data files

You want to check the int value from the count, matches the int value from file B.  Just do an var1 == var2