## MoneyWorks Manual

## Functions

Functions perform calculations that cannot easily be performed using the standard operators alone. Functions always have a list of function parameters enclosed in parentheses.

For example:

` Today() `

` Sum(5, 6, 7) `

` If(A > B, Transaction.Gross, "") `

The parameters of a function need not be simple values—they can be entire subexpressions (including other functions). Some functions (such as Sum()) can take a variable number of parameters.

The parameters to a function are enclosed in parentheses following the function name. Each parameter is separated by a comma. (You can’t use commas as thousand separators when passing a constant number to a function). If the function does not have any parameters, you must still supply the parentheses.

In this section, the function format is illustrated by example. Some functions have optional parameters. The optional parameters in the function format are shown inside square brackets ([ ]). These are there simply to illustrate that the parameter in the brackets is optional. Don’t type the brackets when entering the function in an expression.

Some functions, such as ConcatWith() and Sum() accept a variable number of parameters. This is indicated in the function format by ellipses (...). Don’t type the ellipses when you use the function yourself.

Except for the ExpandList() and ExpandDetail() functions, all functions have a return type of Text, Number, Selection or Date and this return type is indicated for each function definition. Some functions, such as If(), have a return type that will be the same type as one of the parameters, depending on the outcome of the function calculation.

**
Note: **

The following functions can be used in MoneyWorks expressions in data entry, reports and forms (unless otherwise stated). For functions that are specific to mwScript (such as GetFieldValue() or GoToNextField()) see Scripting Functions. A brief outline of scripts is given at *scripts*).