You can easily turn that code into a nice UDF and upload it to cflib.
org :)

-----Original Message-----
From: Dave Carabetta [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 20, 2002 9:29 PM
To: CF-Talk
Subject: Re: Not Rounding Decimals


> We have some numbers to display that have 5 decimal places in the D
atabase
> but we only want to display two of the decimal places but without r
ounding
> the up or down, in other words 10.69751 needs to display as 10.69. 
 Using
> Number( or LSNumber( and masks rounds the number up or down.
>
> Anyone got any ideas on this?
>

Man, this is an ugly way to do it, but the only way off the top of my
 head.
Cut and paste this one to see the output:

<cfset number = 10.298765>
<cfset wholenumber = ListFirst(number, ".")>
<cfset decimal = Left(ListGetAt(number, 2, "."), 2)>
<cfset newnumber = wholenumber & "." & decimal>

<cfoutput>#newnumber#</cfoutput>

Just a thought. I tried things like ToString() thinking that would he
lp, but
CF still rounds it. I'd be curious to see other solutions, if any, my
self.

Regards,
Dave.
_____________________________________________________________________
_
Dedicated Windows 2000 Server
  PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
  Instant Activation � $99/Month � Free Setup
  http://www.pennyhost.com/redirect.cfm?adcode=coldfusiona
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists


______________________________________________________________________
Get Your Own Dedicated Windows 2000 Server
  PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
  Instant Activation � $99/Month � Free Setup
  http://www.pennyhost.com/redirect.cfm?adcode=coldfusionb
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to