How to replace a point in tMap/StringHandling.CHANGE

One Star

How to replace a point in tMap/StringHandling.CHANGE

Hello,
I want to replace a point (.) in a tMap with nothing. I use StringHandling.CHANGE(row1.D,".","") but all the characters are out.
How can I do ?
Excuse me for my poor english ...
Thanh You
Employee

Re: How to replace a point in tMap/StringHandling.CHANGE

Use this code:
StringHandling.CHANGE(row1.D,"\\.","")

Second parameter is considered as a regular expression, it seems to me this basic function shouldn't use regexp to replace strings.
You can add a feature in our Bugtracker to add a "simple" replace strings function.
One Star

Re: How to replace a point in tMap/StringHandling.CHANGE

Thank You !

Re: How to replace a point in tMap/StringHandling.CHANGE

Hello all,
Can you please help in converting the date 2015-02-02 07:54:50 to 20150202075450 please ?
I have been trying the below in a tMap but is issues errors :
StringHandling.EREPLACE(StringHandling.EREPLACE(row1.my_date,"-",""),":","").

It is normal somehow since the input value has type "date" whereas EREPLACE considers type "string". Can you please advise on what I shall use to get this done ?

Thank you and best regards,
Gabriel 
One Star

Re: How to replace a point in tMap/StringHandling.CHANGE

Hello Gabriel,
Think you just want to do Date Format function instead:
TalendDate.formatDate("yyyyMMddhhmmss", row1.my_date)
This will take any Date column and convert it to a string in the format you specify.
Five Stars

Re: How to replace a point in tMap/StringHandling.CHANGE

If you still looking for solution then, I would suggest first parse the original date then use above Date format to get the desire output. 
e.g. 
System.out.println(TalendDate.formatDate("yyyyMMddhhmmss", TalendDate.parseDate("yyyy-MM-dd HH:mm:ss", "2015-02-02 07:54:50")));

Calling Talend Open Studio Users

The first 100 community members completing the Open Studio survey win a $10 gift voucher.

Start the survey

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

Agile Data lakes & Analytics

Accelerate your data lake projects with an agile approach

Watch