Add 0 at the first of No. telephone

Highlighted
Five Stars

Add 0 at the first of No. telephone

I want a expression builder of tMap to test the No of telephone if it < 10 digit add 0+No telephone

StringHandling.LEN("ToMap.telephone") <10 ? "0"+ToMap.telephone

Note the input of telephone and output is String in tMap

Thank you

 

 


Accepted Solutions
Forteen Stars

Re: Add 0 at the first of No. telephone

no question in post :-)

 

but generally

 

ToMap.telephone!=null&&StringHandling.LEN("ToMap.telephone")<10? 
"0"+ToMap.telephone
:ToMap.telephone

must work 

-----------

All Replies
Forteen Stars

Re: Add 0 at the first of No. telephone

no question in post :-)

 

but generally

 

ToMap.telephone!=null&&StringHandling.LEN("ToMap.telephone")<10? 
"0"+ToMap.telephone
:ToMap.telephone

must work 

-----------
Five Stars

Re: Add 0 at the first of No. telephone

thank you
I tested it always no zero in the first of the no. of telephone in database Sql server and also in tLogRow
Forteen Stars

Re: Add 0 at the first of No. telephone

it could be if You use Not String for destination

 

could You attach You settings - column definition in tMap and output table?

-----------

What’s New for Talend Spring ’19

Watch the recorded webinar!

Watch Now

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

Downloads and Trials

Test drive Talend's enterprise products.

Downloads