Easy NumberFormat Question

2004-11-24 Thread Peterson, Andrew S.
Hello,
 
Is there a number formatting function that will show a maximum of two
decimal places when a remainder exists and no decimal places if it
doesn't exist? Right now I'm using numberformat and it's showing two
decimal places when there is no remainder. I'd just like for those cases
to show up as X, not X.00.
 
The last time I did something like this, I did an if statement to check
for the remainder and formatted correspondingly. I think that was CF 5.
Does a function exist for this? 
 
Thanks in advance!
 
Sincerely,
 
Andrew


~|
Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net
http://www.cfhosting.net

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185299
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


RE: Easy NumberFormat Question

2004-11-24 Thread James Smith
You can use...

cfset myNumber = round(myNumber * 100)/100

To get you desired formatting. 

--
Jay

 -Original Message-
 From: Peterson, Andrew S. [mailto:[EMAIL PROTECTED] 
 Sent: 24 November 2004 15:20
 To: CF-Talk
 Subject: Easy NumberFormat Question
 
 Hello,
  
 Is there a number formatting function that will show a 
 maximum of two decimal places when a remainder exists and no 
 decimal places if it doesn't exist? Right now I'm using 
 numberformat and it's showing two decimal places when there 
 is no remainder. I'd just like for those cases to show up as 
 X, not X.00.
  
 The last time I did something like this, I did an if 
 statement to check for the remainder and formatted 
 correspondingly. I think that was CF 5.
 Does a function exist for this? 
  
 Thanks in advance!
  
 Sincerely,
  
 Andrew
 
 
 

~|
Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net
http://www.cfhosting.net

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185302
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


Re: Easy NumberFormat Question

2004-11-24 Thread S . Isaac Dealey
Sierra Bufe submitted this udf to cflib.org:

function RoundIt(num,digits) {
var i = num;
// multiply by 10 to the power of the number of digits to be
preserved
i = i * (10 ^ digits);
// round off to an integer
i = Round(i);
// divide by 10 to the power of the number of digits to be preserved
i = i / (10 ^ digits);
// return the result
return i;
}


cfoutput
div#roundit(10,2)#/div
div#roundit(10.258,2)#/div
/cfoutput

seems to do what you want.

Also seems consistent with James' answer to your question.

 Hello,

 Is there a number formatting function that will show a
 maximum of two
 decimal places when a remainder exists and no decimal
 places if it
 doesn't exist? Right now I'm using numberformat and it's
 showing two
 decimal places when there is no remainder. I'd just like
 for those cases
 to show up as X, not X.00.

 The last time I did something like this, I did an if
 statement to check
 for the remainder and formatted correspondingly. I think
 that was CF 5.
 Does a function exist for this?

 Thanks in advance!

 Sincerely,

 Andrew


 

~|
Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net
http://www.cfhosting.net

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185312
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


RE: Easy NumberFormat Question

2004-11-24 Thread Peterson, Andrew S.
Thanks guys. I checked cflib but missed this. 
 
Sincerely,
 
Andrew

-Original Message-
From: S. Isaac Dealey [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, November 24, 2004 10:24 AM
To: CF-Talk
Subject: Re: Easy NumberFormat Question

Sierra Bufe submitted this udf to cflib.org:

function RoundIt(num,digits) {
var i = num;
// multiply by 10 to the power of the number of digits to be
preserved
i = i * (10 ^ digits);
// round off to an integer
i = Round(i);
// divide by 10 to the power of the number of digits to be
preserved
i = i / (10 ^ digits);
// return the result
return i;
}


cfoutput
div#roundit(10,2)#/div
div#roundit(10.258,2)#/div
/cfoutput

seems to do what you want.

Also seems consistent with James' answer to your question.

 Hello,

 Is there a number formatting function that will show a maximum of two 
 decimal places when a remainder exists and no decimal places if it 
 doesn't exist? Right now I'm using numberformat and it's showing two 
 decimal places when there is no remainder. I'd just like for those 
 cases to show up as X, not X.00.

 The last time I did something like this, I did an if statement to 
 check for the remainder and formatted correspondingly. I think that 
 was CF 5.
 Does a function exist for this?

 Thanks in advance!

 Sincerely,

 Andrew


 



~|
Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net
http://www.cfhosting.net

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185318
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


RE: Easy NumberFormat Question

2004-11-24 Thread S . Isaac Dealey
 Thanks guys. I checked cflib but missed this.

 Sincerely,

 Andrew

Welcome. It was something I'd seen in the code recently at my 9-5 job,
otherwise I likely wouldn't have been able to offer the suggestion. :)

s. isaac dealey   954.927.5117

new epoch : isn't it time for a change?

add features without fixtures with
the onTap open source framework
http://www.sys-con.com/story/?storyid=44477DE=1
http://www.sys-con.com/story/?storyid=45569DE=1
http://www.fusiontap.com




~|
Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net
http://www.cfhosting.net

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185359
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


Another NumberFormat question - brackets for negative numbers

2002-07-31 Thread Andrew Peterson

Hi,

I cant figure out how to use numberformat to surround negative numbers with
brackets. Well, I can, but if I do, it appears that I also have to
incorporate the _ or the 9 for place settings, which I do not care for.  Any
ideas? If there isn't one out there, I will try to roll my own.

Thanks,
Andrew

__
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



Re: Another NumberFormat question - brackets for negative numbers

2002-07-31 Thread Joe Eugene

You probably have to use an IIF Statement and do some like
cfset num=-10)
#IIF(num LT 0,'(#right(num,len(num)-1)#)','#num#')#

If you dont want.
#numberformat(-10,(__.__))#

Joe

- Original Message -
From: Andrew Peterson [EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Sent: Wednesday, July 31, 2002 9:40 AM
Subject: Another NumberFormat question - brackets for negative numbers


 Hi,

 I cant figure out how to use numberformat to surround negative numbers
with
 brackets. Well, I can, but if I do, it appears that I also have to
 incorporate the _ or the 9 for place settings, which I do not care for.
Any
 ideas? If there isn't one out there, I will try to roll my own.

 Thanks,
 Andrew

 
__
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



Numberformat question.

2001-04-05 Thread C. Hatton Humphrey

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.?

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



RE: Numberformat question.

2001-04-05 Thread Tumy, Brad

can't you output like this:

$#numberformat(number,mask)#

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 05, 2001 11: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.?

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



RE: Numberformat question.

2001-04-05 Thread Larry Juncker

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.")#
/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.?

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



RE: Numberformat question.

2001-04-05 Thread C. Hatton Humphrey

I've been playing with a few different masks, but anytime I set up a decimal
mask it's forcing all the places, so for example, if I have the mask set at
",9$99.", the numbers get formatted (using the examples I cited
originally) $45.9000, $9.9900, $2.8950 and $0.4585.

What I need is $45.90, $9.99, $2.985 and $0.4585.

Hatton

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


 can't you output like this:

 $#numberformat(number,mask)#

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, April 05, 2001 11: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.?

 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



RE: Numberformat question.

2001-04-05 Thread C. Hatton Humphrey

Oy, that almost merits being put into a custom tag with as many times as I'm
going to have to call it!

I had come to the conclusion that I could do something similar to this, but
was hoping that there was a way to do it dynamically within the numberformat
function.  I guess there isn't.

Thanks!
Hatton

 -Original Message-
 From: Larry Juncker [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, April 05, 2001 1: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.")#
   /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.?

 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



RE: Numberformat question.

2001-04-05 Thread Philip Arnold - ASP

 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.")#
   /CFIF

A shorter version;
#NumberFormat(Item,"$999,999.#RepeatString("9",Len(ListLast(Item,".")))#")#

Or, if you always want the 2 digits on the end;
#NumberFormat(Item,"$999,999.#RepeatString("9",Max(2,Len(ListLast(Item,"."))
))#")#

I haven't tested this, it's just typed...

Philip Arnold
Director
Certified ColdFusion Developer
ASP Multimedia Limited
T: +44 (0)20 8680 1133

"Websites for the real world"

**
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
**



~~
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



RE: Numberformat question.

2001-04-05 Thread mherbene

How do you know which number gets which format?  Is there some clue in
another db field, or is it based on how many digits after the decimal point,
or what?

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


I've been playing with a few different masks, but anytime I set up a decimal
mask it's forcing all the places, so for example, if I have the mask set at
",9$99.", the numbers get formatted (using the examples I cited
originally) $45.9000, $9.9900, $2.8950 and $0.4585.

What I need is $45.90, $9.99, $2.985 and $0.4585.

Hatton

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


 can't you output like this:

 $#numberformat(number,mask)#

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, April 05, 2001 11: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.?

 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



RE: Numberformat question.

2001-04-05 Thread Larry Juncker

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.")#
/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.?

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



RE: Numberformat question.

2001-04-05 Thread Truman Esmond III

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
9700508B94F380method=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.")#
/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.?

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



RE: NumberFormat question

2000-04-29 Thread Dave Watts

 Anyone know why I would get a value of 0 in an input text
 field when I do this against a numeric column which has a
 null in the database?

 input type="text" name="testval" value="#NumberFormat("#varname#")"

ColdFusion doesn't recognize null as a value, so it converts it to an empty
string. The NumberFormat function converts the empty string to zero. That
shouldn't come too much as a surprise, because we expect the output of the
function to be numeric.

On a side note, you don't need to use so many pound signs and quotes. You
could do this instead:

input type="text" name="testval" value="#NumberFormat(varname)#"

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444

--
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.



NumberFormat question

2000-04-28 Thread Lomvardias, Christopher

Hi,

Anyone know why I would get a value of 0 in an input text field when I do
this against a numeric column which has a null in the database?

input type="text" name="testval" value="#NumberFormat("#varname#")"


Chris
--
Chris Lomvardias
[EMAIL PROTECTED]
Syscom, Inc.
400 E. Pratt Street, Suite 300
Baltimore, MD 21202
(410)539-3737 x1722 voice
(410)539-7302 fax
[EMAIL PROTECTED] (pager via email)
http://www.syscom.com/
--

--
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.



RE: NumberFormat question

2000-04-28 Thread Shane Witbeck

Is the database field itself defined as type "text" or "number" ?

Sincerely,

Shane Witbeck
Webmaster
[EMAIL PROTECTED]
www.digitalsanctum.com




-Original Message-
From: Lomvardias, Christopher [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 28, 2000 4:19 PM
To: ColdFusion Discussion List
Subject: NumberFormat question


Hi,

Anyone know why I would get a value of 0 in an input text field when I do
this against a numeric column which has a null in the database?

input type="text" name="testval" value="#NumberFormat("#varname#")"


Chris
--
Chris Lomvardias
[EMAIL PROTECTED]
Syscom, Inc.
400 E. Pratt Street, Suite 300
Baltimore, MD 21202
(410)539-3737 x1722 voice
(410)539-7302 fax
[EMAIL PROTECTED] (pager via email)
http://www.syscom.com/
--


--
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.

--
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.