House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home /  Groups /  ColdFusion Talk (CF-Talk)

functions

  << Previous Post |  RSS |  Tree View |  Sort Oldest First |  Subscribe to this Group Next >> 

functions

Yes.  Yes I did. Ben Doom 05/28/2004 01:55 PM
Thanks everyone for helping out.  I have it pretty well now. daniel kessler 05/28/2004 01:27 PM
<A HREF="http://www.houseoffusion.com/docs/cfscript.htm" target="_blank" Charlie Griefer 05/28/2004 12:32 PM
Yes, the val() used in the function is there because CF is type less.  Ian Skinner 05/28/2004 12:26 PM
There's a mediocre chapter on script in the Designing Applicaitons book Ben Doom 05/28/2004 12:25 PM
>Um... no. Val() is a CF function. I think you mean var. And it must be at daniel kessler 05/28/2004 12:25 PM
You surround the function declaration (in the script version) with Ben Doom 05/28/2004 12:23 PM
ok I see,  thanks. daniel kessler 05/28/2004 12:17 PM
Um... no. Val() is a CF function. I think you mean var. And it must be at Raymond Camden 05/28/2004 12:17 PM
ah locals, nice. daniel kessler 05/28/2004 12:08 PM
Dain's example was a function and could either be in a CFC or a UDF Bryan Stevenson 05/28/2004 12:07 PM
huh. so I don't have to surround it with cfscript?  How is this daniel kessler 05/28/2004 12:06 PM
huh. so I don't have to surround it with cfscript?  How is this daniel kessler 05/28/2004 12:05 PM
> pascal, that just looks like ECMA (JS, AS), can you elaborate? Ben Doom 05/28/2004 12:00 PM
> Also, why did you val the pv? Ben Doom 05/28/2004 12:00 PM
which one would be the one Dain displayed? daniel kessler 05/28/2004 11:57 AM
though it's kinda wordy, it seems to be what I want. daniel kessler 05/28/2004 11:54 AM
pascal, that just looks like ECMA (JS, AS), can you elaborate? daniel kessler 05/28/2004 11:52 AM
Your Options: Bryan Stevenson 05/28/2004 11:05 AM
You can use CFFUNCTION in MX: Dain Anderson 05/28/2004 11:04 AM
function myFunction(some_passed_var){ Pascal Peters 05/28/2004 11:03 AM
< Daniel Kessler 05/28/2004 10:58 AM

05/28/2004 01:55 PM
Author: Ben Doom Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32850#164875 Yes.  Yes I did. :-) --Ben Raymond Camden wrote: ----- Excess quoted text cut - see Original Post for more -----
05/28/2004 01:27 PM
Author: daniel kessler Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32850#164867 Thanks everyone for helping out.  I have it pretty well now. ----- Excess quoted text cut - see Original Post for more -----
05/28/2004 12:32 PM
Author: Charlie Griefer Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32850#164853 http://www.houseoffusion.com/docs/cfscript.htm http://tutorial84.easycfm.com/ ----- Excess quoted text cut - see Original Post for more -----
05/28/2004 12:26 PM
Author: Ian Skinner Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32850#164850 Yes, the val() used in the function is there because CF is type less.  Thus your function could receive a string just has happily has an integer or a float as a parameter.  The val() function prevents the math from blowing up if it receives a string instead of a numeric value.  It would cause all non-numeric values to become 0. Confidentiality Notice:  This message including any attachments is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender and delete any copies of this message.
05/28/2004 12:25 PM
Author: Ben Doom Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32850#164848 There's a mediocre chapter on script in the Designing Applicaitons book and section in the livedocs. I vaguely recall Michael Dinowitz putting up a tutorial on it for CF5, but vague memories are often wrong.  :-)  I also seem to recall tutorials on CFLIB.org, and there are plenty of samples to learn from on there. --Ben Doom daniel kessler wrote: ----- Excess quoted text cut - see Original Post for more -----
05/28/2004 12:25 PM
Author: daniel kessler Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32850#164849 >Um... no. Val() is a CF function. I think you mean var. And it must be at >the beginning of a UDF. Ie thanks.  yeah it complains about that and missing semi-colons.  I guess I'm kinda used to flash and being lazy on all that. This is pretty cool and it makes me very happy that I can use functions. > >function foo(x,y) { >  var z = 1; >  z = x*y+9; >  return z; >}
05/28/2004 12:23 PM
Author: Ben Doom Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32850#164847 You surround the function declaration (in the script version) with cfscript tags.  The call doesn't have to be in a cfscript block. There are small differences in loops in the script version vs the tag version, but (afaik) that's all. --Ben Doom daniel kessler wrote: ----- Excess quoted text cut - see Original Post for more -----
05/28/2004 12:17 PM
Author: daniel kessler Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32850#164842 ok I see,  thanks. ----- Excess quoted text cut - see Original Post for more -----    > To: CF-Talk    > Sent: Friday, May 28, 2004 8:57 AM    > Subject: Re: functions > >    > which one would be the one Dain displayed?    > I'm hoping to not make a component since it's really just specific to > this page.  I'm just used to fuctioning duplicate programming. >    > > Your Options:    > > -make a custom tag    > > -make a UDF (user defined function) - see www.cflib.org for info    > > -if on CF MX make a function in a CFC (ColdFusion Component)    > > -go dead simple and make the script an included file and include it >    > > whereever you need it (set your "in" var(s) before including the > file    > > and the "out" gets set in the included file)
05/28/2004 12:17 PM
Author: Raymond Camden Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32850#164843 Um... no. Val() is a CF function. I think you mean var. And it must be at the beginning of a UDF. Ie function foo(x,y) {   var z = 1;   z = x*y+9;   return z; }
05/28/2004 12:08 PM
Author: daniel kessler Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32850#164840 ah locals, nice. That's a boon. Sure would've been nice to have a course in all this instead of ad-hoc and relying on my historical knowledge ("who's buried in grant's tomb" and the like :). >If you use "val" to declare a variable, it is local to the function. >this is a good idea, since otherwise you might accidentally overwrite >something in the variable scope. > >--Ben Doom
05/28/2004 12:07 PM
Author: Bryan Stevenson Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32850#164839 Dain's example was a function and could either be in a CFC or a UDF Bryan Stevenson B.Comm. VP & Director of E-Commerce Development Electric Edge Systems Group Inc. t. 250.920.8830 e. bryan@electricedgesystems.com --------------------------------------------------------- Macromedia Associate Partner www.macromedia.com --------------------------------------------------------- Vancouver Island ColdFusion Users Group Founder & Director www.cfug-vancouverisland.com   which one would be the one Dain displayed?   I'm hoping to not make a component since it's really just specific to this page.  I'm just used to fuctioning duplicate programming.   > Your Options:   > -make a custom tag   > -make a UDF (user defined function) - see www.cflib.org for info   > -if on CF MX make a function in a CFC (ColdFusion Component)   > -go dead simple and make the script an included file and include it   > whereever you need it (set your "in" var(s) before including the file   > and the "out" gets set in the included file)   >
05/28/2004 12:06 PM
Author: daniel kessler Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32850#164838 huh. so I don't have to surround it with cfscript?  How is this different from CFFunction, other than by structure. ----- Excess quoted text cut - see Original Post for more -----
05/28/2004 12:05 PM
Author: daniel kessler Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32850#164837 huh. so I don't have to surround it with cfscript?  How is this different from CFFunction? ----- Excess quoted text cut - see Original Post for more -----
05/28/2004 12:00 PM
Author: Ben Doom Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32850#164834 > pascal, that just looks like ECMA (JS, AS), can you elaborate? > do I just put that at the top and call it from cfset? > do I precede it with anything? It's very much like an ECMA language.  The biggest difference (off the top of my head) is that you use CF comparison operators instead of ECMA ones.  That is you use "is" or "eq" instead of "==" and so forth. You can call it from a CFSET if you want the results to be put in a variable: <cfset value = function_name(arguments)> If you just want them displayed, you can do something like <cfoutput> #function_name(arguments)# </cfoutput> --Ben Doom
05/28/2004 12:00 PM
Author: Ben Doom Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32850#164835 > Also, why did you val the pv? If you use "val" to declare a variable, it is local to the function. this is a good idea, since otherwise you might accidentally overwrite something in the variable scope. --Ben Doom
05/28/2004 11:57 AM
Author: daniel kessler Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32850#164832 which one would be the one Dain displayed? I'm hoping to not make a component since it's really just specific to this page.   I'm just used to fuctioning duplicate programming. ----- Excess quoted text cut - see Original Post for more -----
05/28/2004 11:54 AM
Author: daniel kessler Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32850#164831 though it's kinda wordy, it seems to be what I want. so in cfset, I do: <cfset myVar = myFunction(passy_varry)> ? Also, why did you val the pv? thanks for replyin. ----- Excess quoted text cut - see Original Post for more -----
05/28/2004 11:52 AM
Author: daniel kessler Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32850#164830 pascal, that just looks like ECMA (JS, AS), can you elaborate? do I just put that at the top and call it from cfset? do I precede it with anything? >function myFunction(some_passed_var){ >  var pv = some_passed_var; >  pv = pv+10; >  return pv; >}
05/28/2004 11:05 AM
Author: Bryan Stevenson Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32850#164817 Your Options: -make a custom tag -make a UDF (user defined function) - see www.cflib.org for info -if on CF MX make a function in a CFC (ColdFusion Component) -go dead simple and make the script an included file and include it whereever you need it (set your "in" var(s) before including the file and the "out" gets set in the included file) HTH Cheers Bryan Stevenson B.Comm. VP & Director of E-Commerce Development Electric Edge Systems Group Inc. t. 250.920.8830 e. bryan@electricedgesystems.com --------------------------------------------------------- Macromedia Associate Partner www.macromedia.com --------------------------------------------------------- Vancouver Island ColdFusion Users Group Founder & Director www.cfug-vancouverisland.com   <   I have a set of code in CF that I use four times in a script.  It   could easily be a function with an in/out but I've yet to see   functions in CF, mostly scripts.  I don't want to do anything special   by making it external or making it nice enough to give to others.  I   just want a callable/reusable function:   function myFunction(some_passed_var){   <cfset pv = some_passed_var>   <cfset pv = pv+10>   return pv   }   Is there something similar in CF?   >   --   Daniel Kessler   Department of Public and Community Health   University of Maryland   Suite 2387 Valley Drive   College Park, MD  20742-2611   301-405-2545 Phone   www.phi.umd.edu
05/28/2004 11:04 AM
Author: Dain Anderson Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32850#164815 You can use CFFUNCTION in MX: <CFFUNCTION NAME="myFunction" RETURNTYPE="numeric">      <CFARGUMENT NAME="some_passed_var" TYPE="numeric">      <CFSET pv = Arguments.some_passed_var>      <CFSET pv = Val(pv + 10)>      <CFRETURN pv> </CFFUNCTION> -Dain Daniel Kessler wrote: ----- Excess quoted text cut - see Original Post for more -----
05/28/2004 11:03 AM
Author: Pascal Peters Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32850#164813 function myFunction(some_passed_var){   var pv = some_passed_var;   pv = pv+10;   return pv; } ----- Excess quoted text cut - see Original Post for more -----
05/28/2004 10:58 AM
Author: Daniel Kessler Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32850#164812 < I have a set of code in CF that I use four times in a script.  It could easily be a function with an in/out but I've yet to see functions in CF, mostly scripts.  I don't want to do anything special by making it external or making it nice enough to give to others.  I just want a callable/reusable function: function myFunction(some_passed_var){   <cfset pv = some_passed_var>   <cfset pv = pv+10>   return pv } Is there something similar in CF? > -- Daniel Kessler Department of Public and Community Health University of Maryland Suite 2387 Valley Drive College Park, MD  20742-2611 301-405-2545 Phone www.phi.umd.edu
<< Previous Thread Today's Threads Next Thread >>

Search cf-talk

May 24, 2012

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
     1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31     

Designer, Developer and mobile workflow conference