Brian Dunning's FileMaker Custom Functions

util.MaxLengthInList ( value_list )

Returns the longest length of the item in the value list.

  Be the first to rate this function Log in to vote

Pip Meadway   Pip Meadway - Show more from this author
PIPCO IT

Share on Facebook Share on Twitter

  Sample input:
$max_length = util.MaxLengthInList ( List ( "Aaaaaa" ; "bbbbbbbbbbbb" ; "cc" ; "2344" ))
  Sample output:
12 // The length of "bbbbbbbbbbbb"

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

This function uses a While loop (only available in FMP18 and above) to calculate the maximum length of an item in a value list.

It will also coincidentally return the length of an individual string, a number implicitly converted to a string, and the length of the filename in a container, such is the forgiving nature of Filemaker.

As this is my first submission, some explanation on my naming standard:

Almost all my custom functions begin with a 'grouping' e.g. this function is a utility function, so it starts with 'util.' I also have 'debug.' and 'iter.' custom functions.

If it's a PRIVATE function (only to be called by other functions) , rather than PUBLIC (can be called from a script), it starts with '~group' e.g. '~util.'

Of course, feel free to rename as you see fit!

 

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: