Quantcast
Channel: Pentaho Community Forums
Viewing all articles
Browse latest Browse all 16689

Javascript - Convert string to number (with a negative sign)

$
0
0
Hello.

I'm not very familiar with Javascript and I'd like to convert a number within a string variable (I'm parsing an excel report where all the data is contained in cell A). Right now, I've been able to extract the data I want and I have as an example "-5000.00" in a string variable. I tried using the calculator to create a copy of field A and automatically cast it to a number but it fail when there's negative values (positive works though).

So now I come back to my JavaScript step and my guess is that I certainly can cast this string into a number directly in there but can't figure out :-( Anyone can help on this matter please?

Thank you for your time.

Regards,
Martin

Viewing all articles
Browse latest Browse all 16689

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>