The decimal type is working fine, but I'm still trying to overcome
this problem:

A user might not follow proper input procedure and instead of inputting
a valid number, say, 100.50 for the payment amount, they might input
$100.50, which gets rejected as a valid number.

What function (like LSParseNumber or LSParseCurrency or whatever) can I use
to change $100.50 to 100.50 so that it'll work as a decimal type?

Something like:

<cfqueryparam cfsqltype="CF_SQL_DECIMAL"
value="#LSParseNumber(Form.PaymentAmount)#">

Rick


-----Original Message-----
From: Matt Robertson [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 17, 2002 1:26 PM
To: CF-Talk
Subject: RE: mySQL equivalent of MS Access "Money" fieldtype?


Sean wrote:
> Integer is the safer way to represent money - as pennies -
> because that way you avoid rounding errors.

Bingo.  Sorry I didn't think to mention that last nite.  'twas a bit
late for me.  I found Sean's point to be especially important when doing
very complex multi-user and multi-step calculations where the level of
precision is mandated by government regulation - specifically a couple
of auto insurance rating systems I built and maintain.

The easy answer would be to use mySQL's Decimal field type and set for a
precision of, say, 8,2.

Cheers,

--Matt Robertson--
MSB Designs, Inc.
http://mysecretbase.com



-----Original Message-----
From: Sean A Corfield [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 17, 2002 9:26 AM
To: CF-Talk
Subject: Re: mySQL equivalent of MS Access "Money" fieldtype?


On Tuesday, Dec 17, 2002, at 07:41 US/Pacific, Stephen Moretti wrote:
> INT is INTEGER which means that there's no decimal places....  Not
> much good
> for real money that I'm afraid.

Integer is the safer way to represent money - as pennies - because that
way you avoid rounding errors. Financial applications should never use
floating point to represent dollars (or whatever). If you take 0.00 and
add 0.01 a hundred times, you're quite likely to get something which
does not equal 1.00 because of inherent inaccuracies in floating point
representation.



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm

Reply via email to