Brian Dunning's FileMaker Custom Functions

TextSimplifyChars ( someText ; options )

Simplifies text by converting diacriticals and other characters to their low-ASCII equivalent.

  Be the first to rate this function Log in to vote

Dan Shockley   Dan Shockley - Show more from this author

Share on Facebook Share on Twitter

  Sample input:
TextSimplifyChars ( "François Bątárüski" ; "" )
  Sample output:
"Francois Bataruski"

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

Simplifies text by converting diacriticals and other characters to their low-ASCII equivalent.
Can be used to "simplify" two strings before doing a PatternCount, or other strict matching function.

By default, PatternCount does fairly strict comparisons, while a Find does loose Unicode-equivalence comparisons. That means a Find for a search phrase where words have high-ASCII/Unicode characters will result in finding records on which a PatternCount for the same phrase (intended to find which records have those words _together_, without another word in between) will say there is NOT a match.

This function first converts most diacritical characters to their low-ASCII equivalent. Then, it filters the result to ONLY be the “allowed” low-ASCII characters, so any other high-ASCII/Unicode/emoji get stripped away.
Do that to both the target text and the search phrase, then do a PatternCount using the “simplified” strings, and you can see if the phrase is in the target.

Note that this method could produce false positive (matches) outcomes where a relevant non-simplified character would NOT match between the target and search, but was stripped out and thus ignored. So, this function is best used when false positives (does match) are preferred over false negative (does not match because comparison was too strict).

 

Comments

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: