Yeah, just plug it in. However one really nice way to use UDFs is to create a library of them, which is just a file with a <cfscript> at the top and a </cfscript> at the bottom and a whole bunch of functions in between. Then you can cfinclude that library whenever you need it (you could add <cfinclude template="myfavoriteudfs.cfm"> to your application.cfm file -- doesn't seem to affect performance).
Matthew Walker Electric Sheep Web http://www.electricsheep.co.nz/ ----- Original Message ----- From: "Dave Lyons" <[EMAIL PROTECTED]> To: "CF-Talk" <[EMAIL PROTECTED]> Sent: Sunday, June 08, 2003 12:54 PM Subject: Re: cf math ? > thanks Mathew! you are always such good help! > however, I haven't even gotten to math functions yet not to mention udf's, > lol > I bust Ben out tonight and do some reading but if I remember right I can > just plug that right in correct? > > again thanks, I do appreciate all your help:) > > dave > ----- Original Message ----- > From: "Matthew Walker" <[EMAIL PROTECTED]> > To: "CF-Talk" <[EMAIL PROTECTED]> > Sent: Saturday, June 07, 2003 5:56 PM > Subject: Re: cf math ? > > > > Converting from decimal pounds to pounds and ounces is a data display > issue. > > I think the most useful solution would be a UDF. Then you can use it > > whenever you need to do this. The benefit is that you don't have to touch > > your original data -- the 8.16 still remains afterwards. > > > > <cfscript> > > function poundsAndOuncesFormat(value) { > > var returnString = ""; > > var pounds = int(value); > > var ounces = (value - pounds) * 16; > > ounces = round(ounces * 100) / 100; // round ounces off at 2 > > decimal places > > if ( pounds ) > > returnString = pounds & " lb"; > > if ( ounces ) > > returnString = listappend(returnString, ounces & " oz", " "); > > return returnString; > > } > > </cfscript> > > > > <cfoutput>#poundsAndOuncesFormat(8.16)#</cfoutput> > > > > Matthew Walker > > Electric Sheep Web > > http://www.electricsheep.co.nz/ > > > > ----- Original Message ----- > > From: "Dave Lyons" <[EMAIL PROTECTED]> > > To: "CF-Talk" <[EMAIL PROTECTED]> > > Sent: Sunday, June 08, 2003 8:51 AM > > Subject: Re: cf math ? > > > > > > > ok 1 more ? > > > I forgot part of it > > > > > > what I am actually trying to do is make a form to estimate the weight of > a > > > fish based upon length & girth. > > > > > > So the first part is ok ( I was leaving out a set of ()) > > > > > > so the first formula works > > > and lets say that the fish is 29" long and 15" girth > > > it would weight 8.16 pounds > > > now the next part I don't know if I need a regex for or how to do it. > > > > > > I want to take the .16 from the weight (or variable c) > > > and divide it by 16 to get the ounces > > > so instead of the final answer being 8.16 pounds it would be 8 pounds > 2.56 > > > ounces. > > > > > > I can see how I could do another form to do it but it would be nice to > > have > > > it done all in 1 shot. But I don't know how to get rid of the pounds > part > > in > > > the 2nd equation. > > > > > > any thoughts? > > > > > > thanks again:) > > > Dave > > > > > > > > > > > > > > > ----- Original Message ----- > > > From: "Tony Gruen" <[EMAIL PROTECTED]> > > > To: "CF-Talk" <[EMAIL PROTECTED]> > > > Sent: Saturday, June 07, 2003 4:21 PM > > > Subject: RE: cf math ? > > > > > > > > > > This should get you on your way... > > > > -------------------------------------------------- > > > > <CFLOCK timeout="4"> > > > > <CFSET A = 5> > > > > <CFSET B = 3> > > > > <CFSET D = 800> > > > > <CFSET C = ((#A# * #A#) * #B#) / #D#> > > > > </CFLOCK> > > > > <html> > > > > <head> > > > > <title>Simple Math</title> > > > > </head> > > > > <body> > > > > <cfoutput>#NumberFormat(C, '_____.__')#</cfoutput> > > > > </body> > > > > </html> > > > > > > > > -----Original Message----- > > > > From: Dave Lyons [mailto:[EMAIL PROTECTED] > > > > Sent: Saturday, June 07, 2003 12:34 PM > > > > To: CF-Talk > > > > Subject: cf math ? > > > > > > > > > > > > i havent got to math functions yet but how would i do this in cf? > > > > > > > > > > > > ((variableA x variableA) x variableB) / 800 = variableC > > > > > > > > thanks > > > > > > > > > > > > > > > > > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| 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 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

