Solutions > Core4 CRM

Bug in FormatCurrency Custom Function?

(1/1)

mcspencer:
The way the FormatCurrency CF is currently written is causing unexpected behavior when dealing with negative numbers that are less than 1.

The "Prevent Negative Zero" portion causes the amount to flip from a negative to a positive because wholePart = 0


--- Code: ---    //prevent negative zeroes
    signPrefix = Case ( wholePart = 0 ; "" ; signPrefix )
--- End code ---

If you change it to this:


--- Code: ---    //prevent negative zeroes
    signPrefix = Case ( wholePart = 0 and decimalPart = 0; "" ; signPrefix )
--- End code ---

It will then still prevent negative zeroes but still allow for negative amounts less than 1.

As currently coded:



With new code:

Navigation

[0] Message Index

Go to full version