Brian Dunning's FileMaker Custom Functions

ContainsAll ( Text ; SearchStrings )

checks to see whether all values in SearchStrings are contained in Text

  Average rating: 4.6 (24 votes) 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:
ContainsAll ( "24128" ; "412" )
ContainsAll ( "Jim,Charlie,Frank,Jane,Michelle,George,Kim,Chris" ; "Jim,Chris,Jane" )
ContainsAll ( "Jim,Charlie,Frank,Jane,Michelle,George,Kim,Chris" ; "Jim,Chris, Jane" )
ContainsAll ( "Jim,Jane" ; "m\,J" )
  Sample output:
1
1
0
1

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

Determine whether Text contains ALL of the strings contained in SearchStrings ('and' logic)
In SearchStrings strings should be separated by commas, semicolons, or ¶
To include commas, semicolons, ¶ (to be matched) in SearchStrings, include \ before them
Restriction: the following !-containing strings may not be part of SearchStings: !c! !s! !p!
Similar to Position function but will assess several SearchStrings, gives 0 or 1 (No or Yes) as Result
Written in response to request from John Vermeulen
Updated April 2017 with no functional change, just easier-to-understand formatting and comments
A shortcoming of this occurred to me: the entirety of Text is evaluated for each new SearchStrings value. Thus, ContainsAll ("Mike,Pete" ; "Pete¶ete¶e\,P") would evaluate as 1, even though it's finding the same text over and over. The same would happen with the SearchString being "Pete¶Pete".

 

Comments

John Segers   John Segers
Jun 12, 2019
Thanks a lot, just the function I was looking for for so long but didn't manage to create on my own. And it works perfectly ;)
 

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: