Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

This topic is 4127 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

I'm looking for a way to strip or filter out "accent marks" like this é

The below code strips out the entire character.

Filter( yourTextFieldHere ; "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890`~!@#$%^&*()_+=-[];',./{}|:"<>? " ) 

Wondering if there is an alternative way to strip out the accent mark but keep the character?

Posted

That's assuming you know what the character is. This is a calculation field that would strip the accent mark and leave the character (whatever that would be.

Posted

perhaps some creative use of http://www.briandunning.com/cf/175 or http://www.briandunning.com/cf/285

Posted

you would have to create a nested substitute such as

Substitute (text ; ["å" ;"a" ]; ["é" ; "e"] ;[ "ü"; "u"] )

basically a set for every accent you wish to substitute.

Posted

Hmm. I'll take a look at both options, luckily most accents are on the "vowels" (atleast for the characters I'm dealing with)

Thanks for the suggestions, I'm sure one of them will work just fine.

Posted

The only way to do this in Filemaker is by multiple substitutes - which means you have to actively list all possible accented characters. There may be another way to do this outside of Filemaker - search for "Unicode decompose".

  • 4 years later...
Posted

Yeah… I know this topic is a bit old, but this might help someone.

Multiple substitutes is not the only way to do this in Filemaker. Filemaker talks AppleScript which opens the whole world !

OK Comment, strictly speaking you are doubly right. AppleScript is "outside of Filemaker" even if you write it inside, and the way to go is indeed Unicode manipulation  :Whistle:

Perl does this very well, and you can call Perl from AppleScript from Filemaker. Twisted or what !?  :logik:

You need a temporary field in Filemaker to pass in the string you want to check, as you can't pass variables directly to AppleScripts (yet?).

 

As from there, in your verification script just include a "Do AppleScript" line, with the following in the script section :

 

 

set the_string to field "VarTemp" of current record
 
set p_script to ¬
"# -*- coding: utf-8 -*-
import unicodedata, sys
 
def normalize(x):
    normal_form_1 = 'NFKD'
    normal_form_2 = 'NFC'
    x = unicodedata.normalize(normal_form_2, x)
    x = x.lower()
    x = x.replace(u'ß', u'ss')
    x = x.replace(u'å', u'aa')
    x = unicodedata.normalize(normal_form_1, x)
    x = u''.join([c for c in x if not unicodedata.combining©])
    x = x.encode('utf-8')
    return x
arg = sys.argv[1].decode('utf-8')
x = normalize(arg)
print x"
 
set p_script to quoted form of p_script
set the_string to quoted form of the_string
 
set the_result to (do shell script ("python -c " & p_script & " " & the_string))
 
set field "VarTemp" of current record to the_result
 
* "VarTemp" being the temporary field that you set up in Filemaker.
 
Credits to Jürgen Schell for the Python/AppleScript work. I merely integrated it into Filemaker  :worship:
Posted
Filemaker talks AppleScript which opens the whole world !

 

Well, Filemaker talks AppleScript - but only when running on a MacOS platform, so strictly speaking ...  :hmm:

 

Still, I suppose you could run a very similar code in Java using the ScriptMaster plugin. So now the only remaining question is what is this good for.

This topic is 4127 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.