RE: Fighting with NumberFormat
Just try this with your number format #NUMBERFORMAT(1234.1200,'9.99')# Or if its always going to be a Money amount #DOLLARFORMAT(1234.1200)# Hope this helps. Jason E Miller Computer Consultants Unlimited http://www.computercu.com Brainbench Certified Cold Fusion Developer 4.5 Transcript Link: http://www.brainbench.com/transcript.jsp?pid=477741 -Original Message- From: Cameron [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 20, 2001 8:21 PM To: CF-Talk Subject: Fighting with NumberFormat Hi all, I dunno if anyone has had this problem before, but I have been fighting with NumberFormat for about an hour now... I am getting a Cost Price for a product from a database which stores the price as "Money". So I am trying to keep things consistant remove the extra zeros' that are returned (1234.1200). I'm _trying_ to use NumberFormat(cost_price, "__.__") to format it as "0.00" etc. But I am getting some weird results cost_price=1234.12 = NumberFormat(cost_price, '__.__') =1232. cost_price=50.00 = NumberFormat(cost_price, '__.__') = 50.00 I have used combinations of everything I can think of 1234.1200 = '__.00' = 1232. 50. = '__.00' = 50.00 1234.1200 = '00.9900' = 1234.12 50. = '00.9900' = 50. etc, etc... Can someone PLEASE help me get this consitent... all I want is 2 decimal's after the decimal place, and any number before it. Cameron Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists ~~ 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: Fighting with NumberFormat
Your results are slightly different than what I get when I test it. I get the string * if I try to stuff 1234.12 into a five character mask. Make sure you have a sufficient number of mask characters to the left of the decimal point. You can always LTrim() the results to eliminat the leading spaces. NumberFormat(cost_price, "___.00") or LTrim(NumberFormat(cost_price, "___.00")) Jim - Original Message - From: "Cameron" [EMAIL PROTECTED] To: "CF-Talk" [EMAIL PROTECTED] Sent: Tuesday, March 20, 2001 9:21 PM Subject: Fighting with NumberFormat Hi all, I dunno if anyone has had this problem before, but I have been fighting with NumberFormat for about an hour now... I am getting a Cost Price for a product from a database which stores the price as "Money". So I am trying to keep things consistant remove the extra zeros' that are returned (1234.1200). I'm _trying_ to use NumberFormat(cost_price, "__.__") to format it as "0.00" etc. But I am getting some weird results cost_price=1234.12 = NumberFormat(cost_price, '__.__') =1232. cost_price=50.00 = NumberFormat(cost_price, '__.__') = 50.00 I have used combinations of everything I can think of 1234.1200 = '__.00' = 1232. 50. = '__.00' = 50.00 1234.1200 = '00.9900' = 1234.12 50. = '00.9900' = 50. etc, etc... Can someone PLEASE help me get this consitent... all I want is 2 decimal's after the decimal place, and any number before it. Cameron ~~ 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