CountWordOccurrences ( text ; searchWord )
Returns the number of occurrences of searchWord as word in text.
Average rating: 4.9 (34 votes) Log in to vote
Michael Horak - Show more from this author
*COMMENT Visual Realisation |
CountWordOccurrences ( "Tom stomped on an atom." ; "tom" )
CountWordOccurrences ( "Tom's tomcat stomped on an atom." ; "tom" )
1
0
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
Returns the number of occurrences searchWord appears as a word in text. The function is NOT case-sensitive.
Comments
Henk Brendel, Arnhem, NL Feb 8, 2012 |
||
PatternCount ( text ; " " & Trim ( searchWord ) & " " ) Isn't this simpler, doing the same thing and at least not recursive? |
||
comment, VR Feb 8, 2012 |
||
It may be simpler, but it's not doing the same thing at all: check your results against mine in the examples above. | ||
Henk Brendel, Arnhem, NL Feb 8, 2012 |
||
I see what you mean, sorry about this. | ||
Danton Wetzel, Saint George, UT Sep 10, 2013 |
||
This is exaclty what I need, but FileMaker 11 gives me an error. "This function cannot be found." I believe it is refering to "Let ( countWords = WordCount ( text )". Can you help me understand, please. dwetzel@skywest.com Thanks in advance. |
||
jLT StructuresFromSilence, Kendv,IN USA Apr 8, 2015 |
||
Like this function much but problems with it. Dear dwetzel@skywest.com, You ever get this custom function to work properly? CountWordOccurrences() When i use it in a text field that is lengthy i get a spinning ball and have to wait long time!! Robert |
||
comment, VR Apr 8, 2015 |
||
@jLT This function goes over your text word-by-word. That takes some time. It was not meant to be applied to large texts, and in any case the maximum amount of words it can process is limited to 10,000 (Filemaker's limit of iterations for custom functions that are not tail-recursive). You may consider implementing the same algorithm in a looping script, and run the script on demand only, storing the result in a field. |
||
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.