We just found a ready-made solution to the same problem.
Check out Russ Michaels custom tag in the DevEx-
cf_zerokiller found at the URL:

http://devex.allaire.com/developer/gallery/info.cfm?ID=CA34775F-2830-11D4-AA
9700508B94F380&method=Full


Does the trick.  Too bad NumberFormat() isn't a little smarter.  ;)
Truman

-----Original Message-----
From: Larry Juncker [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 05, 2001 2:15 PM
To: CF-Talk
Subject: RE: Numberformat question.


Hatton;

The code below will do exactly as you ask.  Only on the first if statement
where I have the mask as .9 change it to .99 and it works fine.

Larry Juncker
Senior Cold Fusion Developer
Heartland Communications Group, Inc.


-----Original Message-----
From: Larry Juncker [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 05, 2001 12:44 PM
To: CF-Talk
Subject: RE: Numberformat question.


This isn't pretty, however it does work.

        <CFIF Len(ListLast(Item,".")) EQ 1>
                #NumberFormat(Item, "$999,999.9")#
        <CFELSEIF       Len(ListLast(Item,".")) EQ 2>
                #NumberFormat(Item, "$999,999.99")#
        <CFELSEIF       Len(ListLast(Item,".")) EQ 3>
                #NumberFormat(Item, "$999,999.999")#
        <CFELSEIF       Len(ListLast(Item,".")) EQ 4>
                #NumberFormat(Item, "$999,999.9999")#
        </CFIF>


Larry Juncker
Senior Cold Fusion Developer
Heartland Communications Group, Inc.


-----Original Message-----
From: C. Hatton Humphrey [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 05, 2001 10:36 AM
To: CF-Talk
Subject: Numberformat question.


I have a situation where I need to display a price with either 2, 3 or 4
digits after the decimal place.  The database is storing the information
properly, but I need to format the display to "trim" the output.

For example, I have three prices for four items:

Item 1 has a price of 45.9
Item 2 has a price of 9.99
Item 3 has a price of 2.985
Item 4 has a price of 0.4585

I need the price to display as $45.90 for Item 1, $9.99 for Item 2, $2.985
for item 3 and $0.4585 for item 4.  I know I can't use DollarFormat, since
it trims at two decimal places.  The question is, how do I set up the
NumberFormat to show the pricing properly when possible top-ends are up to
$999,999,999.9999?

TIA
Hatton
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to