Built-in function calls

FormCalc supports a large set of built-in functions with a wide range of capabilities. The names of the functions are case-insensitive, but unlike keywords, FormCalc does not reserve the names of the functions. This means that calculations on forms with objects whose names coincide with the names of FormCalc functions do not conflict.

Functions may or may not require some set of arguments to execute and return a value. Many functions have arguments that are optional, meaning it is up to you to decide if the argument is necessary for the particular situation.

FormCalc evaluates all function arguments in order, beginning with the lead argument. If an attempt is made to pass less than the required number of arguments to a function, the function generates an error exception.

Each function expects each argument in a particular format, either as a number literal or string literal. If the value of an argument does not match what a function expects, FormCalc converts the value. For example:

    Len(35)

The Len function actually expects a literal string. In this case, FormCalc converts the argument from the number 35 to the string “35”, and the function evaluates to 2.

However, in the case of a string literal to number literal, the conversion is not so simple. For example:

    Abs("abc")

The Abs function expects a number literal. FormCalc converts the value of all string literals as 0. This can cause problems in functions where a 0 value forces an error, such as in the case of the Apr function.

Some function arguments only require integral values; in such cases, the passed arguments are always promoted to integers by truncating the fractional part.

Here is a summary of the key properties of built-in functions:

  • Built-in function names are case-insensitive.

  • The built-in functions are predefined, but their names are not reserved words. This means that the built-in function Max never conflicts with an object, object property, or object method named Max.

  • Many of the built-in functions have a mandatory number of arguments, which can be followed by a optional number of arguments.

  • A few built-in functions, Avg, Count, Max, Min, Sum, and Concat, accept an indefinite number of arguments.

For a complete listing of all the FormCalc functions, see the Alphabetical Functions List.

// Ethnio survey code removed