Brian Dunning's FileMaker Custom Functions

dfAlphaNumericFilter ( Text ; ReplaceText )

Replace non alphanumeric characters with anything (or nothing)

  Average rating: 4.4 (30 votes) Log in to vote

Caspar Harmer   Caspar Harmer
Digital Fusion Ltd
http://www.digitalfusion.co.nz

Share on Facebook Share on Twitter

  Sample input:
dfAlphaNumericFilter("345---+++ab//321";"*"),

or
dfAlphaNumericFilter("345---+++ab//321";"")
  Sample output:
345******ab**321


or
345ab321

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

Recursive function that filters out anything that is not alphanumeric
ie not from 0...9 and from a...Z.
It will replace the filtered text with nothing (filter it),
or replace the text with your desired string.

 

Comments

Ross Hurley   Ross Hurley, Adelaide, Australia
Feb 2, 2009
I've created the custom function. Now how do you use it? I've tried a calculated Replace on the field concerned, putting the CF into the calculation dialog. The Text parameter is easy, but what do I do with the ReplaceText parameter?
 
Rick   Rick, Yigo, Guam
Jan 28, 2013
Caspar,

Thanks for that. Worked like a charm.

Rick
 
Caspar Harmer   Caspar Harmer, San Mateo, CA
Jan 28, 2013
you use it in a script or as the result of a calculated field.
Text is whatever text you want to process
ReplaceText is what you want to be put in place of text you are removing. Look at the example to see how this is used. i.e. any character that is replaced is replaced with the character or string that you specify.
 
genekeats   genekeats, Los Angeles
Feb 28, 2013
Thank you, Caspar. Saved me at least an hour of head thrashing. :-)
 
Carl-Gustaf   Carl-Gustaf, Sweden
Sep 1, 2015
Thanks very much
Exellent! I find very useful information here and it's slick

Thanks for these custom functions !

keep up the good work!

g.ydstrom@hotmail.com
 
Roxanne Van den Berg   Roxanne Van den Berg, Cape Town, South Africa
Jan 12, 2016
HI,

I'm feeling very stupid for not figuring out this custom function.
I have replaced the "ReplaceText with "" but now it's telling me that there are too many functions ))
What do i put in by the Function Parameters?
 
Caspar Harmer   Caspar Harmer, New Zealand
Jan 12, 2016
Copy this into your custom function:

If( (Filter ( Left ( Text ; 1 ) ; "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklomnopqrstuvwxyz1234567890" ) =Left(Text;1) );
Left(Text;1) & If( Length(Text)>1; dfAlphaNumericFilter ( Right( Text ; (Length (Text) -1)); ReplaceText)) ;
ReplaceText & If( Length(Text)>1; dfAlphaNumericFilter ( Right( Text ; (Length (Text) -1)); ReplaceText))
)

Now, don't replace anything - assuming you called your function "dfAlphaNumericFilter". If you called it something else, you need to change the name above also (because it calls itself)

Then, feed in your parameters like this : dfAlphaNumericFilter("345---+++ab//321";"").

If you are having trouble, email me at rapsac at gmail dot com
 

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.

Under construction. Email me your wish list for improvements.