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?

-----------

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