comparison between two columns of the same excel file

Five Stars

comparison between two columns of the same excel file

Hello everyone,

I have an excel file that contains several lines of data, and for each line I need to compare two columns of the same line, please how can I proceed?

 

Thank you for your guidance


Accepted Solutions
Highlighted
Employee

Re: comparison between two columns of the same excel file

Hi @didi 

 

Seems pretty straight forward for me.

 

image.png

 

image.png

 

Code to be used is:-

 

Relational.ISNULL(row1.data1) || Relational.ISNULL(row1.data2) || !(row1.data1.equals(row1.data2))? "N":"Y" 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved :-)


Warm Regards,
Nikhil Thampi
Please appreciate our members by giving Kudos for spending their time for your query. If your query is answered, please mark the topic as resolved :-)
Employee

Re: comparison between two columns of the same excel file

Hi Didi,

 

I understand that you're trying to compare 2 columns in an excel file. Please check the below job and see if it solves your problem. A tJavaRow component is added for the custom logic. Please see the custom code in the below screenshot.

community1.png

community2.png

 


All Replies
Nine Stars

Re: comparison between two columns of the same excel file

What is the problem you facing ?

 

did you use , tFileExcelInput and read/compare data ? What do you want do if the columns are same or not same ?

 

Regards
Abhishek KUMAR
( Please mark the post as resolved if you found your solution )
Five Stars

Re: comparison between two columns of the same excel file


thank you for your reply,
Yes I use an tFileExcelInput ,
If the columns are similar I create another column to say it's ok
if it is not similar I must also create a column to say that it's not ok

THANKS
DIDI
Nine Stars

Re: comparison between two columns of the same excel file

tFileInputExcel -- tMap/Tjava -- tFileOutputExcel

 

You can update same excel which you are reading.

To do that in tFileOutputExcel ,

 

select "Append existing excel'

Select "Append existing Sheet" and then

Select "Is absolute Y Pos." in this For C1 , X==2 and Y==0

 

Also Write only result data .e.g.

Input will read column A and B

tMap will compare these two value , column C should be like row1.A.equals(row1.B) ? "same" : "not same"

So tFileExcelOutput should wright only column C. not A and B

 

 

 

 

Regards
Abhishek KUMAR
( Please mark the post as resolved if you found your solution )
Highlighted
Employee

Re: comparison between two columns of the same excel file

Hi @didi 

 

Seems pretty straight forward for me.

 

image.png

 

image.png

 

Code to be used is:-

 

Relational.ISNULL(row1.data1) || Relational.ISNULL(row1.data2) || !(row1.data1.equals(row1.data2))? "N":"Y" 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved :-)


Warm Regards,
Nikhil Thampi
Please appreciate our members by giving Kudos for spending their time for your query. If your query is answered, please mark the topic as resolved :-)
Employee

Re: comparison between two columns of the same excel file

Hi Didi,

 

I understand that you're trying to compare 2 columns in an excel file. Please check the below job and see if it solves your problem. A tJavaRow component is added for the custom logic. Please see the custom code in the below screenshot.

community1.png

community2.png

 

Cloud Free Trial

Try Talend Cloud free for 30 days.

Tutorial

Introduction to Talend Open Studio for Data Integration.

Definitive Guide to Data Integration

Practical steps to developing your data integration strategy.

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.