RE: Numberformat question.
can't you output like this: $#numberformat(number,mask)# -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 05, 2001 11:36 AM To: CF-Talk Subject: Numberformat question. I have a situation where I need to display a price with either 2, 3 or 4 digits after the decimal place. The database is storing the information properly, but I need to format the display to "trim" the output. For example, I have three prices for four items: Item 1 has a price of 45.9 Item 2 has a price of 9.99 Item 3 has a price of 2.985 Item 4 has a price of 0.4585 I need the price to display as $45.90 for Item 1, $9.99 for Item 2, $2.985 for item 3 and $0.4585 for item 4. I know I can't use DollarFormat, since it trims at two decimal places. The question is, how do I set up the NumberFormat to show the pricing properly when possible top-ends are up to $999,999,999.? TIA Hatton ~~ 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: Numberformat question.
This isn't pretty, however it does work. CFIF Len(ListLast(Item,".")) EQ 1 #NumberFormat(Item, "$999,999.9")# CFELSEIF Len(ListLast(Item,".")) EQ 2 #NumberFormat(Item, "$999,999.99")# CFELSEIF Len(ListLast(Item,".")) EQ 3 #NumberFormat(Item, "$999,999.999")# CFELSEIF Len(ListLast(Item,".")) EQ 4 #NumberFormat(Item, "$999,999.")# /CFIF Larry Juncker Senior Cold Fusion Developer Heartland Communications Group, Inc. -Original Message- From: C. Hatton Humphrey [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 05, 2001 10:36 AM To: CF-Talk Subject: Numberformat question. I have a situation where I need to display a price with either 2, 3 or 4 digits after the decimal place. The database is storing the information properly, but I need to format the display to "trim" the output. For example, I have three prices for four items: Item 1 has a price of 45.9 Item 2 has a price of 9.99 Item 3 has a price of 2.985 Item 4 has a price of 0.4585 I need the price to display as $45.90 for Item 1, $9.99 for Item 2, $2.985 for item 3 and $0.4585 for item 4. I know I can't use DollarFormat, since it trims at two decimal places. The question is, how do I set up the NumberFormat to show the pricing properly when possible top-ends are up to $999,999,999.? TIA Hatton ~~ 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: Numberformat question.
I've been playing with a few different masks, but anytime I set up a decimal mask it's forcing all the places, so for example, if I have the mask set at ",9$99.", the numbers get formatted (using the examples I cited originally) $45.9000, $9.9900, $2.8950 and $0.4585. What I need is $45.90, $9.99, $2.985 and $0.4585. Hatton -Original Message- From: Tumy, Brad [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 05, 2001 12:27 PM To: CF-Talk Subject: RE: Numberformat question. can't you output like this: $#numberformat(number,mask)# -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 05, 2001 11:36 AM To: CF-Talk Subject: Numberformat question. I have a situation where I need to display a price with either 2, 3 or 4 digits after the decimal place. The database is storing the information properly, but I need to format the display to "trim" the output. For example, I have three prices for four items: Item 1 has a price of 45.9 Item 2 has a price of 9.99 Item 3 has a price of 2.985 Item 4 has a price of 0.4585 I need the price to display as $45.90 for Item 1, $9.99 for Item 2, $2.985 for item 3 and $0.4585 for item 4. I know I can't use DollarFormat, since it trims at two decimal places. The question is, how do I set up the NumberFormat to show the pricing properly when possible top-ends are up to $999,999,999.? TIA Hatton ~~ 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: Numberformat question.
Oy, that almost merits being put into a custom tag with as many times as I'm going to have to call it! I had come to the conclusion that I could do something similar to this, but was hoping that there was a way to do it dynamically within the numberformat function. I guess there isn't. Thanks! Hatton -Original Message- From: Larry Juncker [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 05, 2001 1:44 PM To: CF-Talk Subject: RE: Numberformat question. This isn't pretty, however it does work. CFIF Len(ListLast(Item,".")) EQ 1 #NumberFormat(Item, "$999,999.9")# CFELSEIF Len(ListLast(Item,".")) EQ 2 #NumberFormat(Item, "$999,999.99")# CFELSEIF Len(ListLast(Item,".")) EQ 3 #NumberFormat(Item, "$999,999.999")# CFELSEIF Len(ListLast(Item,".")) EQ 4 #NumberFormat(Item, "$999,999.")# /CFIF Larry Juncker Senior Cold Fusion Developer Heartland Communications Group, Inc. -Original Message- From: C. Hatton Humphrey [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 05, 2001 10:36 AM To: CF-Talk Subject: Numberformat question. I have a situation where I need to display a price with either 2, 3 or 4 digits after the decimal place. The database is storing the information properly, but I need to format the display to "trim" the output. For example, I have three prices for four items: Item 1 has a price of 45.9 Item 2 has a price of 9.99 Item 3 has a price of 2.985 Item 4 has a price of 0.4585 I need the price to display as $45.90 for Item 1, $9.99 for Item 2, $2.985 for item 3 and $0.4585 for item 4. I know I can't use DollarFormat, since it trims at two decimal places. The question is, how do I set up the NumberFormat to show the pricing properly when possible top-ends are up to $999,999,999.? TIA Hatton ~~ 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: Numberformat question.
This isn't pretty, however it does work. CFIF Len(ListLast(Item,".")) EQ 1 #NumberFormat(Item, "$999,999.9")# CFELSEIF Len(ListLast(Item,".")) EQ 2 #NumberFormat(Item, "$999,999.99")# CFELSEIF Len(ListLast(Item,".")) EQ 3 #NumberFormat(Item, "$999,999.999")# CFELSEIF Len(ListLast(Item,".")) EQ 4 #NumberFormat(Item, "$999,999.")# /CFIF A shorter version; #NumberFormat(Item,"$999,999.#RepeatString("9",Len(ListLast(Item,".")))#")# Or, if you always want the 2 digits on the end; #NumberFormat(Item,"$999,999.#RepeatString("9",Max(2,Len(ListLast(Item,".")) ))#")# I haven't tested this, it's just typed... Philip Arnold Director Certified ColdFusion Developer ASP Multimedia Limited T: +44 (0)20 8680 1133 "Websites for the real world" ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. ** ~~ 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: Numberformat question.
How do you know which number gets which format? Is there some clue in another db field, or is it based on how many digits after the decimal point, or what? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 05, 2001 1:55 PM To: CF-Talk Subject: RE: Numberformat question. I've been playing with a few different masks, but anytime I set up a decimal mask it's forcing all the places, so for example, if I have the mask set at ",9$99.", the numbers get formatted (using the examples I cited originally) $45.9000, $9.9900, $2.8950 and $0.4585. What I need is $45.90, $9.99, $2.985 and $0.4585. Hatton -Original Message- From: Tumy, Brad [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 05, 2001 12:27 PM To: CF-Talk Subject: RE: Numberformat question. can't you output like this: $#numberformat(number,mask)# -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 05, 2001 11:36 AM To: CF-Talk Subject: Numberformat question. I have a situation where I need to display a price with either 2, 3 or 4 digits after the decimal place. The database is storing the information properly, but I need to format the display to "trim" the output. For example, I have three prices for four items: Item 1 has a price of 45.9 Item 2 has a price of 9.99 Item 3 has a price of 2.985 Item 4 has a price of 0.4585 I need the price to display as $45.90 for Item 1, $9.99 for Item 2, $2.985 for item 3 and $0.4585 for item 4. I know I can't use DollarFormat, since it trims at two decimal places. The question is, how do I set up the NumberFormat to show the pricing properly when possible top-ends are up to $999,999,999.? TIA Hatton ~~ 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: Numberformat question.
Hatton; The code below will do exactly as you ask. Only on the first if statement where I have the mask as .9 change it to .99 and it works fine. Larry Juncker Senior Cold Fusion Developer Heartland Communications Group, Inc. -Original Message- From: Larry Juncker [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 05, 2001 12:44 PM To: CF-Talk Subject: RE: Numberformat question. This isn't pretty, however it does work. CFIF Len(ListLast(Item,".")) EQ 1 #NumberFormat(Item, "$999,999.9")# CFELSEIF Len(ListLast(Item,".")) EQ 2 #NumberFormat(Item, "$999,999.99")# CFELSEIF Len(ListLast(Item,".")) EQ 3 #NumberFormat(Item, "$999,999.999")# CFELSEIF Len(ListLast(Item,".")) EQ 4 #NumberFormat(Item, "$999,999.")# /CFIF Larry Juncker Senior Cold Fusion Developer Heartland Communications Group, Inc. -Original Message- From: C. Hatton Humphrey [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 05, 2001 10:36 AM To: CF-Talk Subject: Numberformat question. I have a situation where I need to display a price with either 2, 3 or 4 digits after the decimal place. The database is storing the information properly, but I need to format the display to "trim" the output. For example, I have three prices for four items: Item 1 has a price of 45.9 Item 2 has a price of 9.99 Item 3 has a price of 2.985 Item 4 has a price of 0.4585 I need the price to display as $45.90 for Item 1, $9.99 for Item 2, $2.985 for item 3 and $0.4585 for item 4. I know I can't use DollarFormat, since it trims at two decimal places. The question is, how do I set up the NumberFormat to show the pricing properly when possible top-ends are up to $999,999,999.? TIA Hatton ~~ 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: Numberformat question.
We just found a ready-made solution to the same problem. Check out Russ Michaels custom tag in the DevEx- cf_zerokiller found at the URL: http://devex.allaire.com/developer/gallery/info.cfm?ID=CA34775F-2830-11D4-AA 9700508B94F380method=Full Does the trick. Too bad NumberFormat() isn't a little smarter. ;) Truman -Original Message- From: Larry Juncker [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 05, 2001 2:15 PM To: CF-Talk Subject: RE: Numberformat question. Hatton; The code below will do exactly as you ask. Only on the first if statement where I have the mask as .9 change it to .99 and it works fine. Larry Juncker Senior Cold Fusion Developer Heartland Communications Group, Inc. -Original Message- From: Larry Juncker [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 05, 2001 12:44 PM To: CF-Talk Subject: RE: Numberformat question. This isn't pretty, however it does work. CFIF Len(ListLast(Item,".")) EQ 1 #NumberFormat(Item, "$999,999.9")# CFELSEIF Len(ListLast(Item,".")) EQ 2 #NumberFormat(Item, "$999,999.99")# CFELSEIF Len(ListLast(Item,".")) EQ 3 #NumberFormat(Item, "$999,999.999")# CFELSEIF Len(ListLast(Item,".")) EQ 4 #NumberFormat(Item, "$999,999.")# /CFIF Larry Juncker Senior Cold Fusion Developer Heartland Communications Group, Inc. -Original Message- From: C. Hatton Humphrey [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 05, 2001 10:36 AM To: CF-Talk Subject: Numberformat question. I have a situation where I need to display a price with either 2, 3 or 4 digits after the decimal place. The database is storing the information properly, but I need to format the display to "trim" the output. For example, I have three prices for four items: Item 1 has a price of 45.9 Item 2 has a price of 9.99 Item 3 has a price of 2.985 Item 4 has a price of 0.4585 I need the price to display as $45.90 for Item 1, $9.99 for Item 2, $2.985 for item 3 and $0.4585 for item 4. I know I can't use DollarFormat, since it trims at two decimal places. The question is, how do I set up the NumberFormat to show the pricing properly when possible top-ends are up to $999,999,999.? TIA Hatton ~~ 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: NumberFormat question
Anyone know why I would get a value of 0 in an input text field when I do this against a numeric column which has a null in the database? input type="text" name="testval" value="#NumberFormat("#varname#")" ColdFusion doesn't recognize null as a value, so it converts it to an empty string. The NumberFormat function converts the empty string to zero. That shouldn't come too much as a surprise, because we expect the output of the function to be numeric. On a side note, you don't need to use so many pound signs and quotes. You could do this instead: input type="text" name="testval" value="#NumberFormat(varname)#" Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ voice: (202) 797-5496 fax: (202) 797-5444 -- Archives: http://www.eGroups.com/list/cf-talk To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
RE: NumberFormat question
Is the database field itself defined as type "text" or "number" ? Sincerely, Shane Witbeck Webmaster [EMAIL PROTECTED] www.digitalsanctum.com -Original Message- From: Lomvardias, Christopher [mailto:[EMAIL PROTECTED]] Sent: Friday, April 28, 2000 4:19 PM To: ColdFusion Discussion List Subject: NumberFormat question Hi, Anyone know why I would get a value of 0 in an input text field when I do this against a numeric column which has a null in the database? input type="text" name="testval" value="#NumberFormat("#varname#")" Chris -- Chris Lomvardias [EMAIL PROTECTED] Syscom, Inc. 400 E. Pratt Street, Suite 300 Baltimore, MD 21202 (410)539-3737 x1722 voice (410)539-7302 fax [EMAIL PROTECTED] (pager via email) http://www.syscom.com/ -- -- Archives: http://www.eGroups.com/list/cf-talk To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body. -- Archives: http://www.eGroups.com/list/cf-talk To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.