RE: Displaying decimal part as a fraction...
David, Just wanted to mention that if you use the code i gave you, you SHOULD account for .05 and .25 either specifically or by doing a step -1, not -2. Also, all other odd numbers result in no output, so you need to handle that as well. CFSET startvar = 4.73 CFSET step2 = DollarFormat(startvar) CFSET step3 = Right(#step2#,2) cfloop index="divisor" from="50" to="2" step="-2" CFIF step3 MOD divisor IS 0 AND 100 MOD divisor IS 0 CFSET fraction = step3/divisor "/" 100/divisor CFBREAK /cfif /cfloop cfoutput CFIF isDefined("fraction") AND fraction IS NOT "" #fraction# CFELSE #step3#/100 /cfif /cfoutput ~Simon -Original Message- From: Rice, David [mailto:[EMAIL PROTECTED]] Sent: Wednesday, November 01, 2000 4:39 PM To: CF-Talk Subject: RE: Displaying decimal part as a fraction... Simon, I passed it on to the developer in question, as I will do the amendment, and I'll let you know how it comes out. Again, thanks for the quick response and help. David -- -Original Message- From: Simon Horwith [mailto:[EMAIL PROTECTED]] Sent: Wednesday, November 01, 2000 3:38 PM To: CF-Talk Subject: RE: Displaying decimal part as a fraction... by the way (I just test ran this code, and it did work:) ), you should actually change the step to "-2". ~Simon Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED] Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED]
RE: Displaying decimal part as a fraction...
I passed it on the the programmer who is to use it, Katrina. I haven't heard back from him so apparently it did work. I apologize for not looking it over better from the beginning, Max. I stand chastised... ;) David -- -Original Message- From: Chapman, Katrina [mailto:[EMAIL PROTECTED]] Sent: Wednesday, November 01, 2000 3:51 PM To: CF-Talk Subject: RE: Displaying decimal part as a fraction... Look at the function Max provided you with again. It will do exactly what you're asking for. --K Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED]
Re: Displaying decimal part as a fraction...
David, Would something like this work? Just off the top of my head... CFOUTPUT#ListLast( DollarFormat(myAmount), "." )#/100/CFOUTPUT Not sure if that's really what you (or your fellow) are after HTH, -Max At 11/1/2000 02:33 PM -0600, you wrote: All, I know I've seen somewhere how to do this, but I can no longer remember where I saw it: A fellow programmer needs to show the decimal part of a currency value (i.e., $1.10) as a 10/100 format fraction. Don't even ask why one would want such functionality--the explanation would probably make no more sense to you than it did when explained to me... ;) Does anyone have a custom tag, or a customized way to do this that I could use? Many thanks in advance, -- David L. Rice Web Applications Developer Nation Tax, Inc. [EMAIL PROTECTED] Direct: 205.380.8164 eFax: 253.550.8239 Demo our services @ www.nationtax.com Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED] Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED]
RE: Displaying decimal part as a fraction...
Not really, Max. However, thanks for trying. We can get the decimal part, no problem. We can also perform various rounding schemes, of course. What we actually need is for the decimal part to be "displayed" as a fraction for the user, as in: 10 over 100, or 10/100, in other words. I once saw a function, or custom tag, or something someone had done that accomplished this fraction display. I was hoping someone might remember that and know where it could be found, who had authored it, etc. David -- -Original Message- From: Max Paperno [mailto:[EMAIL PROTECTED]] Sent: Wednesday, November 01, 2000 2:06 PM To: CF-Talk Subject: Re: Displaying decimal part as a fraction... David, Would something like this work? Just off the top of my head... CFOUTPUT#ListLast( DollarFormat(myAmount), "." )#/100/CFOUTPUT Not sure if that's really what you (or your fellow) are after HTH, -Max Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED]
RE: Displaying decimal part as a fraction...
David: try something like this: CFSET startvar = 4.9 CFSET step2 = DollarFormat(startvar) CFSET step3 = Right(#step2#,2) cfloop index="divisor" from="50" to="2" step="-1" CFIF step3 MOD divisor IS 0 AND 100 MOD divisor IS 0 CFSET fraction = step3/divisor "/" 100/divisor CFBREAK /cfif /cfloop cfoutput#fraction#/cfoutput ~Simon -Original Message- From: Rice, David [mailto:[EMAIL PROTECTED]] Sent: Wednesday, November 01, 2000 3:33 PM To: CF-Talk Subject: Displaying decimal part as a fraction... All, I know I've seen somewhere how to do this, but I can no longer remember where I saw it: A fellow programmer needs to show the decimal part of a currency value (i.e., $1.10) as a 10/100 format fraction. Don't even ask why one would want such functionality--the explanation would probably make no more sense to you than it did when explained to me... ;) Does anyone have a custom tag, or a customized way to do this that I could use? Many thanks in advance, -- David L. Rice Web Applications Developer Nation Tax, Inc. [EMAIL PROTECTED] Direct: 205.380.8164 eFax: 253.550.8239 Demo our services @ www.nationtax.com Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED] Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED]
RE: Displaying decimal part as a fraction...
by the way (I just test ran this code, and it did work:) ), you should actually change the step to "-2". ~Simon -Original Message- From: Simon Horwith [mailto:[EMAIL PROTECTED]] Sent: Wednesday, November 01, 2000 4:32 PM To: CF-Talk Subject: RE: Displaying decimal part as a fraction... David: try something like this: CFSET startvar = 4.9 CFSET step2 = DollarFormat(startvar) CFSET step3 = Right(#step2#,2) cfloop index="divisor" from="50" to="2" step="-1" CFIF step3 MOD divisor IS 0 AND 100 MOD divisor IS 0 CFSET fraction = step3/divisor "/" 100/divisor CFBREAK /cfif /cfloop cfoutput#fraction#/cfoutput ~Simon -Original Message- From: Rice, David [mailto:[EMAIL PROTECTED]] Sent: Wednesday, November 01, 2000 3:33 PM To: CF-Talk Subject: Displaying decimal part as a fraction... All, I know I've seen somewhere how to do this, but I can no longer remember where I saw it: A fellow programmer needs to show the decimal part of a currency value (i.e., $1.10) as a 10/100 format fraction. Don't even ask why one would want such functionality--the explanation would probably make no more sense to you than it did when explained to me... ;) Does anyone have a custom tag, or a customized way to do this that I could use? Many thanks in advance, -- David L. Rice Web Applications Developer Nation Tax, Inc. [EMAIL PROTECTED] Direct: 205.380.8164 eFax: 253.550.8239 Demo our services @ www.nationtax.com Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED] Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED] Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED]
RE: Displaying decimal part as a fraction...
Simon, I passed it on to the developer in question, as I will do the amendment, and I'll let you know how it comes out. Again, thanks for the quick response and help. David -- -Original Message- From: Simon Horwith [mailto:[EMAIL PROTECTED]] Sent: Wednesday, November 01, 2000 3:38 PM To: CF-Talk Subject: RE: Displaying decimal part as a fraction... by the way (I just test ran this code, and it did work:) ), you should actually change the step to "-2". ~Simon Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED]
RE: Displaying decimal part as a fraction...
Is this for dollar amounts? Always 2 decimal places? cfset displaydecimal = 100 * (x - int(x)) "/100" Lon Lentz Applications Developer CyberEntomologist - Alvion Technologies DataWarehousing and List Sales - Market Your Lists on the Net! [EMAIL PROTECTED] 941-574-8600 Ext. 210 -Original Message- From: Rice, David [mailto:[EMAIL PROTECTED]] Sent: Wednesday, November 01, 2000 4:20 PM To: CF-Talk Subject: RE: Displaying decimal part as a fraction... We can get the decimal part, no problem. We can also perform various rounding schemes, of course. What we actually need is for the decimal part to be "displayed" as a fraction for the user, as in: 10 over 100, or 10/100, in other words. Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED]
RE: Displaying decimal part as a fraction...
Look at the function Max provided you with again. It will do exactly what you're asking for. --K -Original Message- From: Rice, David [mailto:[EMAIL PROTECTED]] Sent: Wednesday, November 01, 2000 1:20 PM To: CF-Talk Subject: RE: Displaying decimal part as a fraction... Not really, Max. However, thanks for trying. We can get the decimal part, no problem. We can also perform various rounding schemes, of course. What we actually need is for the decimal part to be "displayed" as a fraction for the user, as in: 10 over 100, or 10/100, in other words. I once saw a function, or custom tag, or something someone had done that accomplished this fraction display. I was hoping someone might remember that and know where it could be found, who had authored it, etc. David -- -Original Message- From: Max Paperno [mailto:[EMAIL PROTECTED]] Sent: Wednesday, November 01, 2000 2:06 PM To: CF-Talk Subject: Re: Displaying decimal part as a fraction... David, Would something like this work? Just off the top of my head... CFOUTPUT#ListLast( DollarFormat(myAmount), "." )#/100/CFOUTPUT Not sure if that's really what you (or your fellow) are after HTH, -Max Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED] Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED]