How to compare the two columns in a same file

Highlighted
Nine Stars

How to compare the two columns in a same file

Hello All

 

I have a scenario, that am getting a file with multiple columns, with number of rows, out of that two columns data i need to compare, that two columns data must be exactly equal for every row, how to achieve that

 

example for good data 

 

col1col2
OpenOpen
OpenOpen
OpenOpen

 

if i find That above data file is exactly valid

 

but if the data is in below format file is invalid , even if one row data not matched, i need to reject entire file

 

col1col2
OpenOpen
OpenOpen
Opennot open

 

 

Can anybody suggest good method to approach this

 

Thanks In Advance

Manish

 


Accepted Solutions
Fifteen Stars TRF
Fifteen Stars

Re: How to compare the two columns in a same file

Using a tMap add the following expression to the output filter:
!(""+row1.col1).equals(row1.col2)
This way, invalid records will go to the output flow. Then check how records have been rejected to decide what to do with the file.

TRF

All Replies
Fifteen Stars TRF
Fifteen Stars

Re: How to compare the two columns in a same file

Using a tMap add the following expression to the output filter:
!(""+row1.col1).equals(row1.col2)
This way, invalid records will go to the output flow. Then check how records have been rejected to decide what to do with the file.

TRF
Nine Stars

Re: How to compare the two columns in a same file

@TRF It worked for my requirement , thanks 

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 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog