Thanks for the tips and guidance, Jochem... Rick
> -----Original Message----- > From: Jochem van Dieten [mailto:[EMAIL PROTECTED] > Sent: Thursday, November 01, 2007 4:18 PM > To: CF-Talk > Subject: Re: How to break down a number into percentages > > Rick Faircloth wrote: > > > > 1. dB column is defined as "decimal(10,2)NOT NULL" > > > update accounts > > set balance = <cfqueryparam cfsqltype="cf_sql_decimal" > > value="#LSParseNumber(current_balance)#"> > > where account_id = '#get_accounts.account_id#' > > > > Would this cause the "balance" column variable to come > > an integer? > > No, it would cause the balance column variable to become a decimal with > a scale of 0 (which in CF is not distinguishable from an integer). Use > the scale attribute of cfqueryparam. > > > > > (The code below adds up the current balances in the expense accounts as > > "total_expense") > > > > select sum(monthly_expense) as total_expense from accounts where > > account_type = 'Expense' > > Looks OK. > > > > (This code takes a current account balance (stored as decimal 10, 2) and > > calculates what percentage of "total_expense" is in the budget expense > > accounts.) > > > > <cfset new_amount = get_accounts.balance > > + ((get_accounts.monthly_expense/get_total_expense.total_expense) > > *#LSParseCurrency(form.trans_amount)#)> > > Use PrecisionEvaluate() to do exact math. > > Jochem > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Create robust enterprise, web RIAs. Upgrade to ColdFusion 8 and integrate with Adobe Flex http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJP Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:292519 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

