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 !

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

Tutorial

Introduction to Talend Open Studio for Data Integration.

Watch