Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi there
I have a column (Int) with prices in my db that looks like this
2290
500
1300
I need too make them
22.90
5.00
13.00
In tmap i just put the preis/100 as a double but then i get
22.9
5.0
13.0
How can i make it like i want, i dont need to round or anything just put a . two steps to the left from the last number.
(new java.text.DecimalFormat("0.00")).format(((double)row1.intColumn/100))
(new java.text.DecimalFormat("0.00")).format((row1.intColumn/100))
rhall_2.0 wrote:
I assume you are outputting these numbers as a string. If you are supplying them as numbers, the format is of little consequence apart from to humans. So this solution is intended for converting the numbers before output as String.
You can either create a routine wrapper for this (preferable) or use it as I demonstrate it below....
(new java.text.DecimalFormat("0.00")).format((row1.intColumn/100))
What I am doing is setting a format of a number with 2 decimal places ("0.00") using the DecimalFormat class. This can go into a tMap column expression or into a routine.
(new java.text.DecimalFormat("0.00")).format(((double)row1.intColumn/100))
rhall_2.0 wrote:
Ah OK. Try this.....
(new java.text.DecimalFormat("0.00")).format(((double)row1.intColumn/100))