Thank you to all who attended the March 17th webinar presented by Scott Howard of Scott Howard Consulting, “Extending Your FileMaker Solutions with Custom Functions”. The attendance was great and questions fell right along the targeted skill level of the presentation We were not able to answer all questions, so we do so in more depth below.
Scott provided his custom built sample file Here. It is fully open and the custom functions can be tested and used in your own solutions. Where a function is attributed, please respect the hard work and creativity of its author by including the attribution in your solution.
The webinar video is at the bottom of this page. After the webinar Scott recorded himself building and implementing the first function used in the presentation. Those steps are included in this video.
Q: How do you load a custom functions from one of the custom function web sites?
A: I listed two excellent repositories of FileMaker custom functions in the webinar, briandunning.com and www.fmfunctions.com. If you find a function that seems to solve your problem, keep it open in your browser and then in FileMaker Pro Advanced, open File > Manage > Custom Functions…, then click the “New” button. We will use Kieren MacMillan’s wonderful YearsInteger function. With this function open in your browser and the new Custom Function window open in FileMaker Pro Advanced, copy and paste the elements to build the function. It should look like this (I added the attribution above the calculation.)
Now click “OK” and your function will be ready to use!
Q: Is there a way to store a Custom Function at the application level, so it is available whenever creating a new solution?
A: No. But many developers keep a FileMaker file in which they store reusable Custom Functions, graphics, layout objects scripts, etc. Host this on your FileMaker server or in a known location on your computer so you can copy elements to new solutions when you need them. If this gets full of good stuff, make sure you back it up regularly!
Q: I am using FileMaker Pro 11, will my custom functions migrate when/if I upgrade to 13?
A: Yes, when you open your 11 file(s) in 13, all layouts, calcs, scripts, functions, menus, etc. are converted to the current version. We have done many conversions of very complex solutions and have found very, very little that did not translate well.
Q: Is it possible to pass a list to a custom function?
A: Yes. Please fast forward in the video to 17:07 where I demonstrate the function AddRemoveListItem ( theList ; value ). In it we pass a list of movie titles. Note that I pass the list as a string of items separated by the return character, ¶, like this:
"The Truman Show¶Gatacca¶In Time¶Lord of War"
These items could be field names whose data you want to pass. Let’s say you want to pass the name parts we used in the earlier example. It could look like this:
first_name & "¶" & middle_name & "¶" & last_name
I mentioned more advanced methods for passing complex lists of data, such as a notes field that may contain returns and even HTML pasted from the web. These require “encoding” or cleaning the text so it is seen as a single value. Then, when the value is used, it has to be “decoded” to put it back the way it was originally. These are way beyond the scope of this article, but see these advanced articles for more information: #PARAMETERS, Using name / value pairs for parameters and storing data, FileMaker Dictionary Functions. There are others that a Google search will turn up.
Q: Is possible read a text file into a CF? For example, I have a JSON file in a directory; Can I read this directly into a CF and not convert it to a list to pass it in?
A: No. You cannot pass a file into a Custom Function. As I mentioned in the webinar, the 360Works’ Scribe plugin can extract text from many file types and bring that into FileMaker where all or some of its data could be passed to a Custom Function.
Q: Are there any Custom Functions or scripts that handle natural language queries?
A: A Google search on “natural language queries” suggests that huge computers and enterprise-grade programs attempt to interpret natural language correctly. I doubt FileMaker Pro on my MacBook Pro could match that processing power. That said, many developers have created scripts and functions that take in text and look for a limited list of key words or phrases. So the question is really “What does the user want to accomplish?” FileMaker can probably be programmed to solve many of these user goals. One example I mention in the webinar was a solution we built for an executive recruiting firm. We used the 360Works Scribe plugin to pull text from Word documents, PDFs, and other documents and then a script took that text and looked for certain phrases and key works. With these the solution did some initial categorization of the candidate, but a person eventually added to or edited these categories.
Click Here to download the sample file.
And lastly, here is the webinar video: