Using custom functions
Note This feature is available when the Use advanced tools general setting is selected. See Using advanced tools.
To create a custom function:
-
Choose File menu > Manage > Custom Functions.
-
In the Manage Custom Functions dialog box, click New.
-
In the Edit Custom Function dialog box, for Function Name, type a name for the new function.
Custom function names must be unique and cannot exceed 100 characters.
-
Build a formula.
-
If the formula requires parameters, for Function Parameters, type the parameter name and click Add
. You can edit or delete a parameter name by selecting it in the list and clicking Edit
or Delete
. -
Click where you want an item to appear in the formula box, then perform one of the following actions.
-
All accounts is the default option for Availability and allows all users of the current database to see and use the custom function. If you want the custom function to be available only to those with full access privileges, select Only accounts assigned full access privileges.
-
Click OK to close the Edit Custom Function dialog box.
-
Continue creating custom functions, or click OK to close the Manage Custom Functions dialog box.
|
To add a |
Do this |
|
Reference to a parameter |
In the parameters list, double-click a parameter name. |
|
Mathematical or text operator |
In the keypad, click an operator. |
|
Comparison or logical operator |
For Operators, choose an operator from the list. |
|
Constant value |
Type the value. |
|
Function |
In the functions list, double-click a function. In the formula box, replace the placeholder parameter with a value or expression. |
You can also type parameter names, operators, and functions in the Edit Custom Function dialog box instead of using the lists or keypad.
To change, duplicate, or delete a custom function:
-
Choose File menu > Manage > Custom Functions.
-
In the Manage Custom Functions dialog box:
-
In the Manage Custom Functions dialog box, click OK.
|
To |
Do this |
|
Edit a custom function |
For Function Name, select the custom function and click Edit. In the Edit Custom Function dialog box, make your changes, then click OK. |
|
Duplicate a custom function |
For Function Name, select the custom function and click Duplicate. |
|
Delete a custom function |
For Function Name, select the custom function and click Delete. |
To organize custom functions in folders:
-
Choose File menu > Manage > Custom Functions.
-
In the Manage Custom Functions dialog box:
|
To |
Do this |
|
Create a folder |
Click the arrow next to New and choose Folder. In the Edit Folder dialog, type a folder name. |
|
Rename a folder |
Double-click the folder to rename. Type a new name in the Edit Folder dialog box. |
|
Duplicate a folder |
Select the folder, and click Duplicate. All its custom functions and subfolders are duplicated. |
|
Move a custom function into or out of a folder |
To move a custom function into a folder, expand the folder. Drag the custom function under the expanded folder. To move a custom function out of a folder, drag the custom function above the expanded folder. Or, drag the custom function below the last item in the folder and to the left. |
|
Delete a folder |
Select the folder to delete, and click Delete. You can't undo deleting a folder. The folder and all its custom functions and subfolders are deleted. |
|
View folders and their contents by folder name |
In the list in the upper left of the dialog box, choose a folder name. To show all custom functions, choose Show All. |
|
Filter the list of folders and custom functions by name |
In the search box, type all or part of a folder or custom function name. The list filters as you type: typing a custom function name displays the custom function in the list, and typing a folder name displays the folder and its custom function and subfolders. To show all folders and custom function, clear the box. |
To copy a custom function to another FileMaker Pro file:
-
Choose File menu > Manage > Custom Functions.
-
In the Manage Custom Functions dialog box, select one or more functions you want to copy.
Tip You can press Ctrl-click (Windows) or Command-click (macOS) to select non-contiguous functions, or press Shift-click to select contiguous functions.
-
Press Ctrl+C (Windows) or Command-C (macOS) to copy the functions, then click OK.
Tip macOS: You can choose File menu > Copy to copy a selected function.
-
Open a different FileMaker Pro file.
-
Choose File menu > Manage > Custom Functions.
-
Press Ctrl+V (Windows) or Command-V (macOS) to paste the functions.
Tip macOS: You can choose File menu > Paste to paste a selected function.
The custom function you copied appears at the bottom of the list. If FileMaker Pro determines this function is invalid in the context of the target file (for example, a dependent function, field, or calculation is missing from the target file or the function contains an invalid field type reference), the pasted function is enclosed in comment characters (/*<function_definition>*/). See Custom function dependency rules.
-
Click OK.
Notes
-
Your account must have full access privileges or the Manage database, data sources, containers, and custom functions privilege to open the Manage Custom Functions dialog. The content of a custom function is protected even if Availability is set to All accounts.
-
If you don't have full access privileges and attempt to edit a calculation that uses a custom function restricted to full access accounts, you see the string <Private Function> instead of the custom function. You can't change the calculation as long as the <Private Function> declaration appears in the formula.
-
If you have previously created custom functions and the names are identical to new FileMaker functions, the FileMaker functions will override your custom functions. Verify your custom function names against the FileMaker functions, and change your custom function names if needed.