Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Cherichoc-
Creator
Creator

tMap expression - left character / startsWith string then replace with new character

I need assistance in creating an expression in tMap that if the string starts with "0" or "27" then Replace those characters with "+27"

1 Solution

Accepted Solutions
manodwhb
Champion II
Champion II

@Phumla Qwabe​ ,check the below screenshots.

 

0695b00000IfzkEAAR.png0695b00000IfzjBAAR.png 

tmap expression:-

row2.col.substring(0,1).equals("0") ? "+27"+row2.col.substring(1,(row2.col).length()) :

row2.col.substring(0,2).equals("27") ? "+27"+row2.col.substring(2,(row2.col).length()) : "000000" 

 

 

Thanks,

Manohar

View solution in original post

3 Replies
manodwhb
Champion II
Champion II

@Phumla Qwabe​ ,check the below screenshots.

 

0695b00000IfzkEAAR.png0695b00000IfzjBAAR.png 

tmap expression:-

row2.col.substring(0,1).equals("0") ? "+27"+row2.col.substring(1,(row2.col).length()) :

row2.col.substring(0,2).equals("27") ? "+27"+row2.col.substring(2,(row2.col).length()) : "000000" 

 

 

Thanks,

Manohar

Cherichoc-
Creator
Creator
Author

lets say on there was also '012 572 3535" and i want to also replace the spaces. so after adding "+2712 572 3535" I want to remove the spaces

row2.col.replaceAll(" ", "") is not working

Cherichoc-
Creator
Creator
Author

lets say on there was also '012 572 3535" and i want to also replace the spaces. so after adding "+2712 572 3535" I want to remove the spaces

row2.col.replaceAll(" ", "") is not working

#tMap #regex #expression