Brian Dunning's FileMaker Custom Functions

mapexpr ( expr ; l )

apply an expression to every value in a value list

  Average rating: 4.5 (31 votes) Log in to vote

steve harley   steve harley
paper ape
http://istilldonthaveawebsite.com

Share on Facebook Share on Twitter

  Sample input:
mapexpr (
"left (_v; 3)";
list ("abc"; "wxyz"; "ferdinand")
)
  Sample output:
"abc
wxy
fer"

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

to perform the same operation on every value in a value list (l), supply an expression (expr) for the operation using "_v" for the value; this custom function will traverses the value list and for each value assigns Let() variable _v to the current value, then uses Evaluate() to apply the expression to the value; the result is a value list with each original value transformed by the expression

notes:
• since mapexpr uses GetValue(), the expression should *not* expect values to be return-terminated
• while value lists are by definition text strings, if the text values are numeric, expr can usually use mathematical operations on each value in the list
• Evaluate() will transform any returns in expr to spaces

 

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: