bruceR Posted August 9, 2008 Posted August 9, 2008 Name & Parameters: [color:red][big] FormulaCall ( function ; param ) [/big] Description: Universal recursive custom function Write your functions OUTSIDE of the custom function editor and just pass them to this function. Only two parameters can be passed; your function; and a parameter list Use $variable or $$variables within your function expression if necessary Sample Input: Let( [ $formula=""; $separator = " "; //tab $cellSeparator ="¶"; rowStart = ""; rowEnd = " dataList = "2¶3¶4¶77¶37¶98" ; multiplyValues = "GetValue($param; 1) * Case( ValueCount($param) > 1; FormulaCall ($formula; RightValues($param; ValueCount($param) - 1));1)"; addValues = "GetValue($param; 1) + Case( ValueCount($param) > 1; FormulaCall ($formula; RightValues($param; ValueCount($param) - 1)))"; factorial = "GetValue($param; 1) * Case( $param > 2; FormulaCall ($formula; $param - 1); 1)"; ListValues = "GetValue($param; 1) & $separator & Case( ValueCount($param) > 1; FormulaCall($formula; RightValues($param; ValueCount($param) - 1)))"; htmlRow ="Let( N = valueCount($param); Case( N > 0; GetValue($param; 1) & case( N>1; $cellseparator) & FormulaCall ($formula; RightValues($param; ValueCount($param) - 1) ); ))" ] ; FormulaCall ( multiplyValues ;dataList ) & ¶ & FormulaCall ( addValues ; dataList) & ¶ & FormulaCall ( ListValues ;dataList) & ¶ & FormulaCall ( Factorial; 6) & ¶ & //nested calls FormulaCall ( multiplyValues; substitute( FormulaCall(ListValues; dataList); $separator; "¶") ) & ¶ & " rowStart & FormulaCall ( htmlRow ;dataList) & rowEnd & "¶" ) Results: 6700848 221 2 3 4 77 37 98 720 6700848 2 3 4 77 37 98 Recursive: yes Formula: /* © 2008 Bruce Robertson/Concise Design FormulaCall( formula; param) Universal recursive custom function Write your functions OUTSIDE of the custom function editor and just pass them to this function only two parameters can be passed; your function; and a parameter list Use $variable or $$variables as necessary within your function expression Example: ListValues = "GetValue($param; 1) & $separator & Case( ValueCount($param) > 1; FormulaEval (RightValues($param; ValueCount($param) - 1)))"; Last modified 8/9/2008 */ Case( Formula = "eval"; Let($param = param; Evaluate($formula)); Let([ N = ValueCount(Param); $Formula = formula]; FormulaCall( "Eval"; LeftValues(param; 200) ) & Case(N>200; FormulaCall ( Formula; MiddleValues( Param; 201; N - 200)) ) ) ) Required Functions: Author(s): BruceR Date: 08/09/08 Credits: Disclaimer: FM Forums does not endorse or warrantee these files are fit for any particular purpose. Do not post or distribute files without written approval from the copyright owner. All files are deemed public domain unless otherwise indictated. Please backup every file that you intend to modify.
Lee Smith Posted August 9, 2008 Posted August 9, 2008 (edited) The copy you posted on Brian's Site has a parameter of Function, and my CF hangs on the formula part of your case statement? To clarify a little: Clip Manager grabs the parameters from the name, and the name reads; FormulaCall(Function; param) (same as here), although if you look at the calculation, it is obvious that the parameter is formula, and not Function. Lee Edited August 9, 2008 by Guest
bruceR Posted August 9, 2008 Author Posted August 9, 2008 The copy you posted on Brian's Site has a parameter of Function, and my CF hangs on the formula part of your case statement? To clarify a little: Clip Manager grabs the parameters from the name, and the name reads; FormulaCall(Function; param) (same as here), although if you look at the calculation, it is obvious that the parameter is formula, and not Function. Lee You're right, thanks for noticing, I have updated the info on Brian Dunning's page.
Recommended Posts
This topic is 5950 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now