Brian Dunning's FileMaker Custom Functions

MaxValue ( theList ; treatAsNumeric )

obtain the max value of a list WITHOUT RECURSION (thanks to Agnes Barouh and her "CustomList")

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

Benoit Jolly   Benoit Jolly
Active Développement
http://www.actived.fr

Share on Facebook Share on Twitter

  Sample input:
MaxValue("65¶123¶21" ; 1 )

MaxValue("65¶123¶21" ; 0 )

MaxValue("zzz65¶aaa123¶ccc21" ; 1 )
  Sample output:
123

65

aaa123

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

// obtain the max value of a list WITHOUT RECURSION (thanks to Agnes Barouh and her "CustomList")
// theList : a list of values separated with ¶
// treatAsNumeric : request to handle each value as the "GetAsNumber()" of the value to be computed
//
//
// examples :
// MaxValue("65¶123¶21" ; 1 ) => 123
// MaxValue("65¶123¶21" ; 0 ) => 65 (because the text value of 65 is superior to the text value of 123 in the alphabetical order)
// MaxValue("zzz65¶aaa123¶ccc21" ; 1 ) => aaa123 (it does not take the letters into account for the comparison)
//

 

Comments

Fabrice   Fabrice, Brussels
Jun 20, 2013
Hi Benoît,

I think you'd get faster results and no length limitation with :

Case ( valuecount ( theList ) < 2 ; theList ;
Case ( treatAsNumeric ;
Evaluate ( "Max(" & substitute ( theList ; ¶ ; ";" ) & ")") ;
Evaluate ( "Max(\"" & substitute ( theList ; ¶ ; "\";\"" ) & "\")")
)
)

(I think Ugo posted such a function a while ago)
 
Benoit Jolly Active Développement   Benoit Jolly Active Développement, Lyon France
Jun 20, 2013
Thanks Fabrice for this update... I misused the min/max function when trying in that direction...

Hope to see you at the FMConf this summer.
 

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.

Under construction. Email me your wish list for improvements.