Back When I Created My First Custom Function

From Dwayne Wright PMP, PMI-ACP, CSM
Certified FileMaker Developer

WEB: www.dwaynewright.com
EMAIL: info@dwaynewright.com
TWITTER: dwaynewright
YOUTUBE: FileMakerThoughts

Here is a way that I first used the custom function feature and this was before the great briandunning.com resource was out there. Back when FileMaker 7 was released, I added the ability to write checks directly out of my InBizness SOHO package. I added a layout matched to some blank check stock that I purchased. I then added the basic logic for a print script and needed a calculation to convert the numeric check amount to text format. So that $93.47 can be viewed at ninety three dollars and forty seven cents on the printed check.

I found the calculation example on www.databasepros.com but it was very long and complicated. I could copy and paste the calculation ... but ... then I would need to change every reference to my amount field within the calculation. That spawned an idea about using a custom function.

All I would need to do is fire up the developer edition (now called FileMaker Advanced) and create a custom function for the numbers to dollars text. I would call my parameter the same name that databasepros called the field in their example file. Then within the calculation, I would only have to use my field within the function parameter.

Here you can see the custom function that I created called CheckText. It only has one parameter called amount. So the syntax is CheckText (amount) and you replace the amount string with the number field you want to use.

Here you can see the calculation that I copied from the example file that I downloaded from databasepros.com. They had used a field called Amount in that older FileMaker 6 calculation. I use that word as the name of my custom functions syntax.

Here you can see the actual calculation. I have a transactions table for the Finance module of InBizness SOHO. I use this to record checks written, deposits made, purchased charged and the like. I use the custom function only when writting checks. So I need to get the text for the deduct field because deductions subtract from my bank amount total.

So I have a calculation called CheckText( deduct ) and my calculation works like a charm!

More info about the author and FileMaker in general, contact me at info@dwaynewright.com.

© 2010 - Dwayne Wright - dwaynewright.com