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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Converting a string to BigDecimal

I am trying to convert a string number from one MySQL table to another.

 

I have used the following on many occasions, however it does not seem to be working in this instance and I am unsure as to why. The string it is converting is "50,000.00"

0683p000009M8w5.png

With that formula in tMap it produces the following error:

0683p000009M8wA.png

When I look at the code on 3031:

0683p000009M8wF.png

So something is just not functioning as I expect. Any help would be great.

 

Labels (4)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

If you're trying to get rid of all commas, but retain the '.', you can do something like

row1.Trade_Amount.replaceAll(",","");

you'll also have to reassign the value (i.e. you can't use replace all in-line)

 

I tested this code with the BigDecimal constructor and it seemed to work

View solution in original post

2 Replies
Anonymous
Not applicable
Author

If you're trying to get rid of all commas, but retain the '.', you can do something like

row1.Trade_Amount.replaceAll(",","");

you'll also have to reassign the value (i.e. you can't use replace all in-line)

 

I tested this code with the BigDecimal constructor and it seemed to work

Anonymous
Not applicable
Author

Hi,

 

You have an error in your regex. Use "[^\\d.]"