the problem is that function returns a string. Which is kinda sloppy to deal
with if you want to use the values for any type of calculations (it can be
done by converting the string back to a number but thats why its sloppy!).
A cleaner solution would be to write your own udf that removes the trailing
0's and returns the value.
<cfscript>
function removeTrail(arg) {
// some kind of regex here?
// c'mon. I'm not writing the whole thing!
}
</cfscript>
<cfoutput query="getNums">#removeTrail( getNums.theNum )#<cfoutput>
After you write this udf upload it to www.cflib.org so others don't have to
waste precious keystrokes or braincells.
Good luck,
Brian
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 24, 2002 9:30 AM
To: CF-Talk
Subject: Re: RE: Stupid number format problem
Use the SQL Server str() function in your query to format the number
the way you want it.
----- Original Message -----
From: "Cornillon, Matthieu" <[EMAIL PROTECTED]>
Date: Wednesday, July 24, 2002 10:23 am
Subject: RE: Stupid number format problem
> OK. This is a wretched solution, but you could convert the number
> to a
> string, CFLOOP as long as Right(MyString,1) = "0", and then within
> the loop
> remove that last character. At the end of it, you convert it back
> to a
> number.
>
> I'm almost sorry for even suggesting such an ugly, albeit workable,
> solution.
>
> Hope it helps,
> Matthieu
>
> -----Original Message-----
> From: Phillip B [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 23, 2002 11:04 PM
> To: CF-Talk
> Subject: Re: Stupid number format problem
>
>
> I thought of that but there aren't any functions that I can find
> that will
> handle all the variants I could have. I just need to make sure all
> the extra
> zero's wont be displayed.
>
> Phillip Broussard
> Tracker Marine Group
> 417-873-5957
>
> ----- Original Message -----
> From: "Brian J. LeRoux" <[EMAIL PROTECTED]>
> To: "CF-Talk" <[EMAIL PROTECTED]>
> Sent: Tuesday, July 23, 2002 9:13 PM
> Subject: RE: Stupid number format problem
>
>
> > Check out the functions: numberFormat() and decimalFormat() in
> > http://localhost/CFDOCS/CFML_Reference/Functions2.html or the
> machinewhere
> > you have cf installed.
> >
> > When all else fails, type in your question at
> > http://localhost/CFDOCS/search.cfm and inevidably cf has a
> function to
> > answer.
> >
> > -----Original Message-----
> > From: Phillip B [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, July 23, 2002 7:07 PM
> > To: CF-Talk
> > Subject: Stupid number format problem
> >
> >
> > I need to store numbers in a SQL 2000 database and output them
> on a web
> > page. The numbers will range from being .012345 - 999,999 I set
> up the
> > datatype to be numeric with a precision of 16 and scale of 6.
> When I
> output
> > the values to a web page I get numbers like 96.000000, 96.200000,
> > 1234.000000.
> >
> > I am still new to SQL 2000 and I have never had this problem
> before. Can
> > some one help me out? I am sure this is soooo basic but I just
> can't see
> the
> > problem.
> >
> >
> > Phillip Broussard
> > Tracker Marine Group
> > 417-873-5957
> >
> >
> >
> >
> >
>
>
______________________________________________________________________
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/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists