April 25, 200520 yr Thanks for checking this thread out - I've lurked this forum a bit to get the feel of Custom Functions. Now I'm going to try my hand at a few, and wonder if anyone has seen a good tutorial on it that I can use for a little hand-holding. I'm not new to FMP, having used it since the 2.1 days; but for some reason this is the first time I've thought about writing functions. Just jazzed about 7, I guess. anyway, any pointers to a guide would be much appreciated. Thanks for your time! Tony
April 26, 200520 yr Hi Tony, I'd recommend studying custom functions that others have created. In addition to learning how they work, you may find CFs that already do what you need. There's two basic ways to use CFs: First, for simplifiying a complex calc, hiding that complexity in the custom function. You send the CF a bunch of parameters, and the result pops out. It makes writing your calcs easier. A simple example might be a function to return the area of a circle from a radius. It could be done without the CF, but the CF simplifies things. Second, to recursively scan through or loop through data to find or build a result. The ability to use recursion in custom functions is really what makes them powerful. If you're not used to programming, then recursion is a little abstract. Basically the function operates on a small piece of the data, then calls itself with the rest of data as the new parameter. The recursion continues until a stopping condition is met. Check out this simple recusive example of building a backwards string: http://clevelandconsulting.com/support/viewtopic.php?t=50 Custom functions can be much more powerful than these simple examples, but that gives you the idea.
April 26, 200520 yr I use custom functions anytime I have a fiarly large calculation that I think I will use more than once. Just easier that way imo.
April 26, 200520 yr Author Second, to recursively scan through or loop through data to find or build a result. The ability to use recursion in custom functions is really what makes them powerful. If you're not used to programming, then recursion is a little abstract. Basically the function operates on a small piece of the data, then calls itself with the rest of data as the new parameter. The recursion continues until a stopping condition is met. Perfect. I use loops as a matter of course; this makes a lot of sense to me. Thanks Ender! I also found the Brian Dunning CF Resource last night; studying those has been very helpful. Thanks again to all who responded. Tony
Create an account or sign in to comment