Brian Dunning's FileMaker Custom Functions

MaxNumVal ( TheList )

Evaluates Maximum Numeric Value of a List of VAlues

  Average rating: 4.3 (39 votes) Log in to vote

Christian Jäger   Christian Jäger
Hannover
http://www.hannover.de

Share on Facebook Share on Twitter

  Sample input:
1¶45.667¶3.5
  Sample output:
45.667

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

Max(1;2;3;6) gets the Max. Pity, FileMaker Inc does not yoet recognizes the "¶" Separator in Functions automatically.
European Users: use comma in the Filter Part

 

Comments

Vaughan   Vaughan, Sydney, Australia
Jun 6, 2011
Hello Christian, thanks for posting this. I didn't use the custom function, but I used your method in a calculation field. It has worked ver well.
 
John Weinshel   John Weinshel, Vashon, WA USA
Jul 7, 2014
Thank you, Christian. Very clean and useful.
 
John Davis   John Davis, Houston
Aug 19, 2015
Fails with negative numbers. But simple fix, though. Just simply add a "-" in the Filter characters. Then evaluates properly. Fixed code:

Let(x=Substitute(Filter(TheList;"-0123456789.¶");"¶";";");

Evaluate("Max(" & x &")"))
 
John Davis   John Davis, Houston
Aug 19, 2015
I used your same calculation method for a minimum values custom function. Easy conversion. Be sure to add the "-" in the Filter characters to fix the incompatibility bug with negative numbers.

Find the minimum numeric value from a list of values:

MinNumVal ( TheList )

Let(x=Substitute(Filter(TheList;"-0123456789.¶");"¶";";");

Evaluate("Min(" & x &")"))
 
John Davis   John Davis, Houston
Aug 19, 2015
The html screwed up the calculation above. Let's try it again:

MinNumVal ( TheList )

Let(x=Substitute(Filter(TheList;"-0123456789.¶");"¶";";");

Evaluate("Min(" & x &")"))


You get the idea. Just switch out Min for Max and be sure to add a "-" character in the Filter characters to properly evaluate negative numbers.
 
Eric SCHMIDT   Eric SCHMIDT, CIS
Oct 10, 2017
It fails if "TheList" contains only one Value. You need to trap for it
 
Paul   Paul, Peak 14 LLC
Nov 4, 2021
Also fails if there are null values in the list. I went ahead and created my own CF to fix some of these issues listed here. You can see if here:

https://www.briandunning.com/cf/2550
 

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: