THE PATTERNCOUNT FUNCTION is often overlooked, but very useful in some situations. There are times when, as a developer, you need to find some way to uniquely identify a record (or records) where you do not have a key you can look up. Or even a full word. PatternCount helps mightily at those times:
If FileMaker functions had sleeper hits (as though FileMaker functions have hits at all), PatternCount would be surely be one of them. It’s not like PatternCount does anything particularly impressive. Give it some text and a search term and it gives back the number of times that term appears in the text.
PatternCount ( “This is my example text” ; “i” ) will give back the number 2.
PatternCount ( “Thirty dirty birds type terribly” ; “ty” ) will return the number 3.
Not amazing, I’ll grant you. Not even impressive when you think about it. But like the humble paper clip or coffee mug, what PatternCount lacks in pizazz, it recoups in utility. It’s really really useful.
Of course, the real power lies in substituting the contents of a field into the first slot and testing that value for a match. Read the rest at FullCity.
FileMaker Function of the Week: Case.