Brian Dunning's FileMaker Custom Functions

FilterList ( beginsWith ; oldList ; newList ; iteration )

This recursive function will take a list and return a new list without list values that start with the supplied beginsWith string.

  Average rating: 5.0 (24 votes) Log in to vote

Chris McCue   Chris McCue
Chris McCue
http://www.imccue.com

Share on Facebook Share on Twitter

  Sample input:
FilterList ( "app" ; "apple¶application¶astro¶baseball" ; "" ; "" )
  Sample output:
astro
baseball

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

This recursive function will take a list and return a new list without list values that start with the supplied beginsWith string.

 

Comments

Lorne Walton   Lorne Walton, Maple Ridge, Canada
Mar 12, 2012
Either the cf description is incorrect, or the example give the wrong result.
The result should be:

astro
baseball
 
Chris McCue   Chris McCue, Dallas, TX
Mar 12, 2012
Doh! Nice catch, thanks.
 
Bart Bartholomay   Bart Bartholomay, Vero Beach
Mar 13, 2012
I also think the description is misleading. You're filtering a list, ie you're return values that remain after applying the filter. Here you're taking them out. Why not call it:

ContractList ( theList ; theValue ; theNewList ; theIteration )

Notice that I've reversed the first two and renamed the params for clarity.
 
Davide puppo   Davide puppo, CMI solutions srl
Jun 16, 2018
A great variation is having the list with only the value that "begins with"

change
beginsWith = Left ( $val ; $length )
with
beginsWith ≠ Left ( $val ; $length )
 

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: