
Function: Standard Functions
The standard function repertoire includes various mathematical, date-related, and utility functions. These functions are calculated by the plugin itself, eliminating the need to rely on the FileMaker calculation engine. While these functions can be part of a formula, they are calculated within the plugin.
It's worth noting that the FileMaker calculation engine provides additional functions, which can be used alongside ACF functions by using the "@...@" notation, including calls to other plugin functions. Additionally, type names can be used as functions to convert between different data types. You can also work with date and timestamp formats by using format strings with the date and timestamp functions. For more complex operations, the string functions can be used to convert between date, timestamp, and string representations.
Here's the general prototype for these functions:
x = <function name>(<argument expression>);
Examples:
float x = sqrt(44);
// x will be: 6.6332495807108
// Calculate the length of the hypotenuse using the Pythagorean theorem:
float sidea = 14.0, sideb = 10.0; // These are in inches. We want sidec in cm.
float sidec = 2.54 * sqrt(sidea^2 + sideb^2);
// sidec will be 43.6998123565767 cm.
// If retrieving a field value in the calculation, type conversion is necessary as all variables and fields from FileMaker are treated as strings.
float x = 2.54 * sqrt(float(preferences::sidea)^2 + float(preferences::sideb)^2);
Functions
Here is a listing of the functions available in the current version of the plugin (1.6.3).
Function Name | Argument Type | Result Type | Number of Parameters | Description | ||||
---|---|---|---|---|---|---|---|---|
Array Functions | ||||||||
explode | String Delimiter, String Src | Array String | 2 | Split a string into an array using the specified delimiter. | ||||
implode | String Delimiter, Array String | String | 2 | Combine an array of strings into a delimited string using the specified delimiter. | ||||
sizeOf | Array Types | Int | 1 | Return the size of an array (the number of indexes). | ||||
Cryptography functions | V1.7.0.x | |||||||
create_hash | int method, string data, int encoding | string | 3 | use the constants md5, sha1, sha256 or sha512 to specify the method, and base64enc or hexenc to specify encoding | ||||
create_hmac | int method, string key, string data, int encoding | string | 4 | use the constants md5, sha1, sha256 or sha512 to specify the method, and base64enc or hexenc to specify encoding | ||||
encrypt | int method, string key, string data, int encoding | string | 4 | See documentation page for details | ||||
decrypt | int method, string key, string data, int encoding | string | 4 | See documentation page for details | ||||
Date and Time Functions | ||||||||
date | string {, string format} | Date | 1, 2 | Convert a string formatted date to a date value | ||||
time | string | time | 1 | Convert a time string to a time value | ||||
timestamp | string {, format string} | timestamp | 1, 2 | Convert a timestamp string to a timestamp value | ||||
now | - | Timestamp | 0 | Get the current timestamp in UTC. | ||||
usec | - | Long | 0 | Get the number of microseconds since ACF_run started. | ||||
Internet Functions | V1.7.0.x | |||||||
http_get | string url, string headers, string auth header | String | 3 | creates a get request | ||||
http_post | string url, string post_data, string headers, string auth header | String | 4 | creates a post request | ||||
http_basic_auth | string user, string password | string | 2 | Creates a basic auth header | ||||
Get_cookies | string | 0 | Used after http_get or http_post to get the cookies set by the server. | |||||
Set_cookie | string cookie | string | 1 | returns the header formatted cookie string, to be used in subsequent http_get or http_post | ||||
Send_email | JSON parameters | string | 1 | See the documentation page for details | ||||
File System Functions | ||||||||
close | Int File Number | - | 1 | Close a previously opened file. | ||||
copy_file | String From, String To | String | 2 | Copy a file from one location to another and return "OK" on success. | ||||
create_directory | Path | String | 1 | Create one or more directories recursively and return "OK" on success. | ||||
delete_directory | String Path | String | 1 | Delete a directory at the specified path and return "OK" on success. | ||||
delete_file | String Path | String | 1 | Delete a file at the specified path and return "OK" on success. | ||||
desktop_directory | - | String | 0 | Return the path to the user's desktop directory. | ||||
directory_exists | String Path | Bool | 1 | Check if a directory at the specified path exists (true or false). | ||||
documents_directory | - | String | 0 | Return the path to the user's Documents directory. | ||||
file_exists | String Path | Bool | 1 | Check if a file at the specified path exists (true or false). | ||||
file_size | Numeric Types | String Path | 1 | Return the number of bytes in a file at the specified path. | ||||
list_files | String Path | String | 1 | List files in a directory at the specified path. | ||||
move_file | String From, String To | String | 2 | Move or rename a file from one location to another and return "OK" on success. | ||||
open | FileName, AccessMode | Int | 2 | Open a file with the specified access mode. | ||||
read | Int File Number | String | 1 | Read the content of an opened file. | ||||
readline | Int File Number | String | 1 | Read the next line from an opened file. | ||||
save_file_dialogue | See save_file_dialogue | String | 3 | Present a Save file dialog and return the selected file's path without creating the file. | ||||
select_directory | String Prompt, String Start Directory | String | 3 | Present a directory selection dialog and return the selected directory's path, or an empty string if canceled. | ||||
select_file | String Prompt, String Start-Path | String | 2 | Present a file selection dialog and return the selected file's path, or an empty string if canceled. | ||||
temporary_directory | - | String | 0 | Return the path to the temporary directory. | ||||
FileMaker Functions | ||||||||
eval | String | String | 1 | Evaluate a FileMaker expression. | ||||
Markdown to HTML Functions | ||||||||
markdown2html | String, String, String | Double | 3 | See Markdown functions. | ||||
mdsnippet | - | - | - | See Markdown functions. | ||||
Math Functions | ||||||||
abs | Numeric Types | Double | 1 | Calculate the absolute value. | ||||
acos | Numeric Types | Double | 1 | Calculate the arccosine. | ||||
asin | Numeric Types | Double | 1 | Calculate the arcsine. | ||||
atan | Numeric Types | Double | 1 | Calculate the arctangent. | ||||
cos | Numeric Types | Double | 1 | Calculate the cosine. | ||||
fact | Numeric Types | Double | 1 | Calculate the factorial. | ||||
floor | Numeric Types | Long | 1 | Remove decimals and convert to a long integer. | ||||
mod | Numeric Types | Double | 1 | Calculate the remainder (modulo). | ||||
round | Numeric Types, Int Dec | Double | 2 | Round a number to a specified number of decimal places. | ||||
sin | Numeric Types | Double | 1 | Calculate the sine. | ||||
sqrt | Numeric Types | Double | 1 | Calculate the square root. | ||||
tan | Numeric Types | Double | 1 | Calculate the tangent. | ||||
MySQL External Database Functions | ||||||||
executemysql | - | - | - | See MySQL functions | ||||
mysql_close | - | - | - | See MySQL functions | ||||
mysql_getcolumncount | - | - | - | See MySQL functions | ||||
mysql_getrow | - | - | - | See MySQL functions | ||||
mysql_getrowcount | - | - | - | See MySQL functions. | ||||
mysql_query | - | - | - | See MySQL functions | ||||
Regular Expressions | ||||||||
regex_extract | - | - | - | See Regular Expressions. | ||||
regex_match | - | - | - | See Regular Expressions. | ||||
regex_replace | - | - | - | See Regular Expressions. | ||||
regex_search | - | - | - | See Regular Expressions. | ||||
String Functions | ||||||||
ascii | String | Int | 1 | Return the ASCII code of the first character in the argument. | ||||
between | String Source, String From-String, String To-String | String | 3 | Return the string between two specified substrings. | ||||
char | Int | String | 1 | Return a string containing one character with the specified ASCII code. | ||||
format | String Format, ... | String | n | Create a string with mixed content using the format function. | ||||
from_utf | String | String | 1 | Convert from UTF8 to other character set encodings. | ||||
GetValue | String, Int n | String | 2 | Retrieve line number n from a string. | ||||
left | String, Int n | String | 2 | Retrieve the left part of a string with n characters. | ||||
length | String | Int | 1 | Calculate the length of a string. | ||||
lower | String | String | 1 | Convert the argument to lowercase letters. | ||||
mid | String, Int start, Int n | String | 3 | Retrieve a middle part of a string, starting at a specified position and including n characters. | ||||
pos | String Source, String Substr | Int | 2 | Get the position of a substring in the source string. | ||||
right | String, Int n | String | 2 | Retrieve the right part of a string with n characters. | ||||
substitute | String Src, String A, String B | String | 3 | Substitute occurrences of A with B in the source string. | ||||
substring | String Source, int from pos{, int length} | String | 2, 3 | return a substring from the source string | ||||
to_utf | String | String | 1 | Convert from other character set encodings to UTF8. | ||||
ValueCount | String | Int | 1 | Return the number of lines in a string. |