So in my last blog post you’ll of noticed that I used a custom function called format.initials. I used the function in my calculated field: c_Postal_Name so that I could extract the initials from a name.
Custom functions are a great way to reuse FileMaker code again and perform the same function on multiple fields. There are some great resources out there to help you get started with custom functions, my favourite of which is the custom function section on Brian Dunning’s site (see here).
Rather than re-invent the wheel it is often possible to take someone elses code and adapt it for your own use. In this instance I took a custom function by Ray Cologon of NightWing Enterprises, designed to calculate Acronyms.
Apart from renaming it to suit my naming convention (I name all custom functions by their function, so Ray’s Acronym Function became format.acronym) I just added
& “. “
to the function in each section of the loop and my format.initials custom function was born.
So here it is:
format.initials (name)
/*Adapted from http://www.briandunning.com/cf/33*/If (WordCount (name) > 1;Upper ( Left (name; 1)) & “. ” &format.initials ( RightWords ( name; WordCount (name) -1));Upper ( Left ( name; 1 )) & “. “)
You’ll also note that I’ve added a reference to the original custom function I’ve adapted so that it’s properly credited and if I need to reference the original again a few months down the line I can easily do so.
Oh and one note of caution here. If you want to make use of custom functions you’ll need FileMaker Pro Advanced.
I’m a small business consultant enabling small business owners to achieve sustainable growth, whilst working part-time at Tees Valley Arts. For more about me personally see peterneal.co.uk