issue with string compare in tMap

Highlighted
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,
Highlighted
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")
Highlighted
One Star

Re: issue with string compare in tMap

Thanks a lot emenuet, now its working as expected !

2019 GARTNER 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

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