issue with string compare in tMap

One Star

issue with string compare in tMap

Hi,
Not sure is there something wrong with the expression
(StringHandling.LEFT(row1.text1,3)=="PNL" ?(row1.text1):" not matching")
here is the data from the file

QU HDQPNSY
.HDQRMSY 242150
PNL
SY0341/25MAR MSP PART3
-MCO121Y-PAD006
1HECKT/ALEXANDER-AM4 .R/CTCT MSP612 338 8880 A
.R/CTCH MSP763 545 9319 H .L/NWZAEA
1HECKT/CATHERINE-AM4
1HECKT/OLIVIA-AM4
and I am getting "not matching for all the rows"
Thanks,
Employee

Re: issue with string compare in tMap

Hello,
With java : do not use == to compare String.
you should use the equals methode like this :

(StringHandling.LEFT(row1.text1,3).equals("PNL")?(row1.text1):" not matching")
One Star

Re: issue with string compare in tMap

Thanks a lot emenuet, now its working as expected !

What’s New for Talend Spring ’19

Join us live for a sneak peek!

Sign up now

Agile Data lakes & Analytics

Accelerate your data lake projects with an agile approach

Watch

Definitive Guide to Data Quality

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

Download

Tutorial

Introduction to Talend Open Studio for Data Integration.

Watch