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

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Replace the character in STRING with tMap

Hi there,

 

I have a String data "\N" in timestamp column and I'd like to replace this character into "null", then convert the type from STRING to DATE.

 

How can I define the conversion rule in tMap ??

 

 

Labels (2)
1 Solution

Accepted Solutions
manodwhb
Champion II
Champion II

@wakkieeeeee ,you need to define manually in tmap for each column.

View solution in original post

6 Replies
manodwhb
Champion II
Champion II

@wakkieeeeee ,you can use the below way.

 

row3.newColumn1.replaceAll("/N","NULL").equals("NULL")?null:TalendDate.parseDate("yyyy-MM-dd HH:mm:ss",row3.newColumn1 )

Anonymous
Not applicable
Author

row1.data.replaceAll("\\\\N", "")

The above would replace \N to nothing in your string "data"

 

TalendDate.parseDate("yyyy-MM-dd HH:mm:ss",
"<Your string here>")

 Use above to parse date from string

Anonymous
Not applicable
Author

Hi there,

 

Thank you for your advise!

Thanks to your help, I could replace the "\N" to "null" and convert from STRING to DATE.

 

By the way, I have to do the same things on the all columns..

How do I cope with it with tMap?

I assume that I can utilize the Var function.

 

The function I created is the below;

row2.session_start_time.replaceAll("\\\\N","NULL").equals("NULL")?null:TalendDate.parseDate("yyyy-MM-dd HH:mm:ss",row2.session_start_time)

 

How can I apply this function to all columns??


tmap image03.PNG
manodwhb
Champion II
Champion II

@wakkieeeeee ,you need to define manually in tmap for each column.

Anonymous
Not applicable
Author

I have to remove double quotes from string but its throwing me below in tmap.

 

 

0683p000009M63Y.png

error msg:

Multiple markers at this line
- The method replaceAll(String, String) in the type String is not applicable for the arguments 
(String)
- Syntax error, insert ")" to complete MethodInvocation
- Syntax error, insert ";" to complete Statement
- String literal is not properly closed by a double-quote
Anonymous
Not applicable
Author

never mind fixed this with
StringHandling.CHANGE(row1.CLRTY_PROJ_NM,"\"","\"\"")