6.2 Extensions and custom functions
The flexibility of FileMaker can be significantly enhanced through the use of plugins, custom functions and JavaScript. These tools allow you to add features that go beyond FileMaker's standard functionality and give you the ability to develop customized solutions for specific requirements. In this chapter, you will learn the basics of FileMaker plugins, how to create and use custom functions, and how to use JavaScript in FileMaker.
Table of contents
Introduction to FileMaker Plugins
What are FileMaker plugins?
FileMaker Plugins are extensions that add additional functions and commands to your FileMaker database. They are often used to perform tasks that are difficult or impossible to accomplish with FileMaker's native functions. Plugins can be developed by third-party providers and offer a variety of advanced features, such as integration with external systems, advanced calculation functions or specialized printing options.
Installation and management of plugins
- Plugin installation:
- FileMaker plugins are usually delivered as .fmx files, which must be copied into the FileMaker plugin folder. The plugin folder is normally located under
~/Library/Application Support/FileMaker/Extensionson macOS andC:\Program Files\FileMaker\Extensionson Windows. - Alternatively, you can display the plugin folder directly from FileMaker Pro. Go to the FileMaker preferences (Mac under File, Windows under Edit). Select the tab Plugins and click on the button Show plugin folder. Copy the new plugin into the folder opened by FileMaker.
- FileMaker plugins are usually delivered as .fmx files, which must be copied into the FileMaker plugin folder. The plugin folder is normally located under
- Activating and deactivating plugins:
- You can activate or deactivate individual plugins in the plugin management. This is useful if you want to temporarily do without certain functions or if you need to find out whether a plugin is causing problems.
- Plugin updates:
- Always keep your plugins up to date to benefit from improvements and bug fixes. Most plugins offer an automatic update function that you can activate directly in FileMaker's plugin management.
FileMaker plugins in gFM-Business
The gFM-Business ERP software is delivered with the MBS FileMaker Plugin and the BaseElements Plugin as standard. To be able to use the integrated e-mail client of gFM-Business Basic and Professional, the MailIt plugin from Dacons is required. For the installation and setup of these plugins in gFM-Business there is a Instructions in the gFM forum.
Popular FileMaker plugins
- MBS FileMaker PluginThis plugin is one of the most comprehensive, offering over 6,000 functions ranging from advanced PDF and image manipulation to complex math calculations.
- 360Works ScriptMasterA free plugin that offers a variety of advanced features and allows users to write their own functions in Groovy.
- Troi pluginsA series of plugins that specialize in various aspects such as file operations, URL processing and more.
Best practices for the use of plugins
- Check compatibilityMake sure that the plugins you are using are compatible with your version of FileMaker. Some plugins may have problems with newer or older versions of FileMaker.
- Keeping an eye on performanceSome plug-ins can affect the performance of your FileMaker database, especially if they perform intensive calculations or data processing. Carefully test the impact of plug-ins on your database performance.
- Consider safety aspectsSince plugins are deeply integrated into the FileMaker system, you should make sure that they come from trustworthy providers and are regularly checked for security updates.
Creating and using custom functions
What are custom functions?
Custom Functions (user-defined functions) in FileMaker allow you to encapsulate recurring calculations or processes in a central function that can then be used throughout the database. These functions are particularly useful when you need to perform complex calculations or string manipulations that go beyond the standard functions.
Creation of custom functions
- Access to the function editor:
- To create a custom function, open the dialog File > Manage > Custom Functions. Here you can manage existing user-defined functions or create a new function.
- Create new function:
- Click on Newto open the function editor. Give the function a meaningful name and define the parameters that it should accept. These parameters can be variables or fields that you use in the function.
Example:
Function: FormatPhone number ( Number )
SetVar ( [
Country code = characterLinks ( number ; 3 );
Remainder = character center ( number ; 4 ; 10 )
] ;
"+" & Country code & " " & CharacterLeft ( Remainder ; 3 ) & "-" & CharacterRight ( Remainder ; 7 )
) - Using the custom function:
- Once the function has been created, you can use it in any calculation in your database by calling it like a normal FileMaker function.
- Nesting of custom functions:
- Custom Functions can also call other user-defined functions, allowing you to build and reuse complex logic in a modular way.
Creation of custom functions
- Access to the function editor:
- To create a custom function, open the dialog File > Manage > Custom Functions. Here you can manage existing user-defined functions or create a new function.
- Create new function:
- Click on Newto open the function editor. Give the function a meaningful name and define the parameters that it should accept. These parameters can be variables or fields that you use in the function.
Example:
Function: FormatPhone number ( Number )
SetVar ( [
Country code = characterLinks ( number ; 3 );
Remainder = character center ( number ; 4 ; 10 )
] ;
"+" & Country code & " " & CharacterLeft ( Remainder ; 3 ) & "-" & CharacterRight ( Remainder ; 7 )
) - Using the custom function:
- Once the function has been created, you can use it in any calculation in your database by calling it like a normal FileMaker function.
- Nesting of custom functions:
- Custom Functions can also call other user-defined functions, allowing you to build and reuse complex logic in a modular way.
Management and organization of custom functions
- Documentation of the functions:
- Provide a detailed description for each custom function that explains what the function does, what parameters it requires and what results it delivers. This makes it easier for other developers to maintain and use the function.
- Versioning of custom functions:
- When you update a function, you should maintain version control to ensure that changes are documented and can be undone if necessary.
- Avoidance of redundancies:
- Avoid creating multiple custom functions that perform similar tasks. Before creating a new function, check whether a similar one already exists and extend it if necessary.
Best practices for custom functions
- Efficiency of the functionsWrite custom functions as efficiently as possible to avoid unnecessary calculations. This contributes to the better performance of your database.
- Clarity and maintainabilityMake sure that your custom functions are clear and well documented to facilitate maintainability, especially in larger projects with multiple developers.
- Error handlingImplement basic error handling mechanisms within your functions to catch unexpected inputs or scenarios.
gFM-Business Open Source FileMaker Basis-ERP
The software for the crash course
Download for free
Use of JavaScript in FileMaker
Why use JavaScript in FileMaker?
JavaScript is a widely used programming language that is primarily used for developing interactive web applications. In FileMaker, you can use JavaScript to create advanced user interfaces, dynamic visualizations and interactive features that would be difficult to implement with FileMaker's standard tools.
Embedding JavaScript in FileMaker
- Use of WebViewers:
- The easiest way to use JavaScript in FileMaker is via the WebViewer. The WebViewer can execute HTML, CSS and JavaScript and allows you to integrate web applications directly into your FileMaker layouts.
- Create a WebViewer in your layout and enter the HTML code that contains JavaScript. You can also refer to external JavaScript files that are hosted on a server.
Example:
<html>
<body>
<h1>Hello, FileMaker!</h1>
<script type="text/javascript">
document.body.style.backgroundColor = "#FFDDC1";
</script>
</body>
</html - Communication between FileMaker and JavaScript:
- FileMaker enables communication between your database and JavaScript in the WebViewer via the function
FMP:with which you can call scripts in FileMaker from JavaScript. This makes it possible to have user actions in the WebViewer react directly to the database.
Example:
function saveData() {
var data = document.getElementById('inputField').value;
window.location = "fmp://$/Scriptname?Param=" + encodeURIComponent(data);
} - FileMaker enables communication between your database and JavaScript in the WebViewer via the function
- Use of JavaScript libraries:
- You can embed popular JavaScript libraries such as jQuery, D3.js or Chart.js into the WebViewer to create advanced user interfaces or visualizations. This allows you to integrate dynamic charts, interactive tables or complex forms that go beyond the native capabilities of FileMaker.
FileMaker ERP with many integrated custom functions
More information
