Brian Dunning's FileMaker Custom Functions

MaxListValue18 ( lst ; Type_1Text_2Numb_3Date_4Time_5TS )

Determines the maximum value from a ¶-delimited value list, depending on data type, and requires FileMaker 18 or later

  Be the first to rate this function Log in to vote

Bill Thurmes   Bill Thurmes - Show more from this author
MDCA
http://www.miyotadca.com

Share on Facebook Share on Twitter

  Sample input:
MaxListValue18 ( "-123¶-5¶-12¶-97.6" ; 1 )
MaxListValue18 ( "-123¶-5¶-12¶-97.6" ; 2 )
  Sample output:
-97.5
-5

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

Selects the maximum value from a value list. The type is the second parameter, after the value list. Since it uses the SortValue function, it requires at least FMP 16.

 

Comments

Fabrice Nordmann   Fabrice Nordmann, 1-more-thing
Nov 2, 2019
Just to save some CPU cycles:
GetValue ( SortValues ( _list ; _type *-1 ) ; 1 )
 
Bill Thurmes   Bill Thurmes, MDCA
Nov 4, 2019
Brilliant! Replace my 86 lines of code with just one. I like it! Except, with my $Data, evaluating as types 1,2,3,4,5 should result in values 1,5,3,2,4 being chosen; with the SortValue-based CF, values 1,5,1,1,4 are chosen. The values are not rearranged when assigned types 3 or 4. Problem with SortValues, or am I just overlooking something?
 
KHALID SAID   KHALID SAID , K.D
Nov 4, 2019
Hello my brothers
I want help from the owner of the experience
...
I want the currency function .... and that the decimal fraction consists of 3 numbers
 
KHALID SAID   KHALID SAID , K.D
Nov 4, 2019
I want help
 
Bill Thurmes   Bill Thurmes, MDCA
Nov 12, 2019
I had tested my function with a short list, and it worked fine, but with a 52.8K-item list, it took over 3 min (unacceptable!); with the same data Fabrice's took 243 ms. So, I'll replace mine with his. Concerning my comment above, if the data is Cast as time or date, it sorts fine as time or date; my step-by-step While comparison used GetAsDate or GetAsTime to force the data into the appropriate type, but retained the other half of the timestamp. Not nearly enough benefit for the cost.
For Khalid Said: try going to community.filemaker.com to get help.
 

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: