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 :-)

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
Eleven 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
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
Eleven 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
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 :-)

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

 

Five Stars

Re: comparison between two columns of the same excel file

your code works very well thank you.
I want to read line by line of a column and returned the value of the line n ° 5 for example

do you have an idea to do this please
Employee

Re: comparison between two columns of the same excel file

@didi 

 

Since your new question is a totally different scenario, could you please post it as a new query? Please add sample input records and expected output records with detailed description so that Community members will be interested in it.

 

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 :-)

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Agile Data lakes & Analytics

Accelerate your data lake projects with an agile approach

Watch