Currency to string conversion (loss of decimal)

0
Hi guys, When I use '$ ' + toString($Expense/MyTotal) with MyTotal being a currency value (take $15.00 for example), the value that is returned is "$ 15.0" rather than "$ 15.00". In other words, the last decimal is removed when converting a currency to a string. Any idea how to get my last decimal back? I want it back :( Note that this doesn't apply for values such as $ 13.37.
asked
2 answers
7

'$ ' + formatFloat($Expense/MyTotal, '###,###,###,##0.00')

The 3 zero's at the end will force the number to always show these decimals, regardless of whether they are there or not.

10000 will come out as $ 10,000.00

edit: Edited the answer to include Lex's comment. Thanks Lex!

answered
5

By the way, the above doesn't work when a value is $ 0.00, since it will display $ .00, so I used

if $Expense/MyTotal = 0 then '$ 0.00' else '$ ' + formatFloat($Expense/MyTotal, '###,###,###,###.00')

and that fixed that problem right there.

answered