Brian Dunning's FileMaker Custom Functions

PatternCountMultiTotal ( Text ; SearchList, CaseSensitive )

It extend the PatternCount function to a valuelist

  Average rating: 4.0 (6 votes) Log in to vote

Philip Wang   Philip Wang - Show more from this author
106th Street Wheel and Tire
http://www.106sttire.com

Share on Facebook Share on Twitter

  Sample input:
PatternCountMultiTotal( "We jump we laugh we smile we JUMP again.";"We¶JUMP"; 0 )

PatternCountMultiTotal( "We jump we laugh we smile we JUMP again.";"We¶JUMP"; 1 )
  Sample output:
6


2

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

If the SearchList contains only one value, it acts exactly like PatternCount, except that CaseSensitive option.

The order of the value list doesn't matter. For example, if Text is "888 888", and the SearchList is "888¶8". The search of "888" always returns 2, the search of "8" always returns 6, no matter the order of the list.

I use this function to check invalid characters in a string.

 

Comments

Philip Wang   Philip Wang, 106th Street Wheel and Tire
Feb 18, 2017
The reason I use Substitute instead of direct PatternCount is for the CaseSensitive. PatternCount don't have this option so I had to do it this way.

With this function the validating multiple invalid characters became easy. Here is and example:

Not PatternCountMultiTotal ( Self ; "|¶'¶\"¶,¶;¶ ¶/¶\\" ; 0 )

The above will validate against the characters | ' " , ; / \ and space. You can add any characters or words that you don't like.

Also a good use of it is to search multiple derogatory terms. You can have a long list of words that's not allow, run this function and you will see any hits.
 

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: