Brian Dunning's FileMaker Custom Functions

FormulaCall ( formula ; param )

Universal custom function - write your function outside the CF editor

  Average rating: 3.9 (41 votes) Log in to vote

Bruce Robertson   Bruce Robertson - Show more from this author

Share on Facebook Share on Twitter

  Sample input:
Let([
datalist = "2¶7¶3";
multiplyValues = "GetValue($param; 1) * Case( ValueCount($param) > 1;
FormulaCall ($formula; RightValues($param; ValueCount($param) - 1));1)"];
FormulaCall( multiplyValues; dataList)
)
  Sample output:
42

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

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

==========
Example
==========

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 &
"
)

==========
Result
==========

6700848
221
2 3 4 77 37 98
720
6700848









2 3 4 77 37 98

 

Comments

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 20 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: