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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Convert a string value of format “$$$$$$$$$$$cc" "0000000005200" for example would convert to string 52.00 with expression builder in tMap and handle "" values

I've tried a few different regex in my tMap component for this input column and not having any luck. I have Input values like "0000000005200" Look at the screenshot below. These are String values and will stay a String through the tMap.

0683p000009M3yR.png

I''ve Tried 

 

"".equals(row1.MAX_AMT)? "" : String.format("%05.2f", Long.parseLong(row1.MAX_AMT)/100.00)

Got this error

 

Exception in component tMap_1 (HHV_PreSelect)
java.lang.NumberFormatException: For input string: ""

 

 

row1.MAX_AMT.substring(0,row1.MAX_AMT.length()-2)  --> First Variable

row1.MAX_AMT.substring(row1.MAX_AMT.length()-2,row1.MAX_AMT.length())  -->Last Variable

Var.First.replaceFirst("^0+(?!$)", "") +"."+Var.Last --> Output

 

 

Got this error

 

java.lang.StringIndexOutOfBoundsException: String index out of range: -2
at java.lang.String.substring(Unknown Source)

 

Please advise

 

Thanks

 

Andrew

Labels (3)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

1 Reply
Anonymous
Not applicable
Author

Solved myself!