Functions

Functions are built-in routines that accept a given number of parameters and return a single value. Use functions to manipulate field contents and variables that are used in commands.

Note

Functions do not modify field data, functions generate and return a new value based on a calculation or algorithm that uses field data or variables as input. Use the value the function returns as input for a command.

Function syntax

Functions start with the function name followed directly by an opening parenthesis, a comma-separated list of 0 or more values that are passed into the function as arguments, and a closing parenthesis.

Example

The BETWEEN(value, min, max) function takes three arguments and returns true if the value falls within the range or false if it falls outside the range:

  • value – the expression or field to test
  • min – the minimum of the range
  • max – the maximum of the range
BETWEEN(amount, 500, 5000)

Function arguments

An argument of a function is a specific input value passed into the function.

Function arguments are passed to functions via an argument list. This is a comma-delimited list of literal values, variables, or expressions that evaluate to values of the parameter data type. For more information about working with data types, see Data types.

Note

If your project works with European number formats, or if you are writing scripts that are portable across regions, separate function arguments with a space character instead of a comma unless you are passing in a signed numeric value. Functions accepting signed numeric values require an explicit delimiter.

Functions vs commands

The distinction between commands and functions is subtle but critical to using ACLScript:

Functions Commands
Use fields, values, or records as input and generate a new value that is returned. Use tables as input and generate new records and tables.
Used in expressions, computed fields, command parameter values, variables, and filters to assist and modify command execution. Used to analyze data, import data, and produce results.
Cannot be an independent step in a script. Can be an independent step in a script.