Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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
Labels (2)
5 Replies
amaumont
Contributor III
Contributor III

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.
Anonymous
Not applicable
Author

Thank You !
Anonymous
Not applicable
Author

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 
Anonymous
Not applicable
Author

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.
Anonymous
Not applicable
Author

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")));