About functions
A function is a predefined, named formula that performs a specific calculation and returns a single, specific value.
Most functions include three basic parts:
- the function name
- a set of parentheses, if the function takes parameters
- the parameters required by the function
Each function returns a result of field type text, number, date, time, timestamp, or container.
For information about where functions can be used, see About formulas.
Note For information on how functions evaluate differently on the host versus the client, search the Knowledge Base.
Parameters
Function parameters can be constants (such as 1.07 or "hello"), field references (such as InvoiceTotal), expressions (such as 1 + 12), or other functions (such as the NPV
function). You can use spaces before or after the parentheses used to enclose the parameters, but spaces are not necessary. When a function requires more than one parameter, separate individual parameters with a list separator, such as a semicolon. You must specify parameters in the same order shown when you add a function in the Specify Calculation dialog box.
Braces ({ }) surround optional parameters (for example, the Case function and Choose function). If you specify an optional parameter, you must also specify all optional parameters that precede it. An ellipsis (...) signifies that you can add more parameters, each separated by a semicolon (for example, in aggregate functions). Double quotation marks (" ") indicate a text string.
Literal text parameters such as filenames and layout names must be enclosed in quotation marks. Use quotation marks around field names to indicate the literal string is the parameter (omit quotation marks to indicate the value stored in the field is the parameter). You can use spaces before or after the parentheses that enclose parameters, but spaces are not necessary. Use a semicolon between parameters when a function requires more than one parameter.
This table shows examples of some FileMaker Pro functions.
This function |
Returns |
Length("John") |
4, the number of characters in the text "John" |
Round(SalesTax,2) |
The amount of sales tax rounded to two decimal places |
Position(Name, "Mc",1,1) |
A number representing the starting position of one text string within another, in this case indicating the position of the first occurrence of "Mc" in the Name field |
Get(LastError) |
A number representing the error (if any) in the most recently executed script step in the currently running script |
Sum(ExtendedPrice) |
The total of all the values in the repeating field ExtendedPrice |