Functions are commands similar to statements, but unlike statements, they return a value that is then used by another portion of the script. For example, the countitems() function is used to count the number of entries in a list box field displayed in a window. The name of the list box field is the function’s parameter while the number of items displayed in the list box is the value returned. The following example sets the variable “number” to the number of items in the list box named Shipping Methods.
number = countitems('Shipping Methods');
Functions such as countitems() are built into sanScript. The sanScript language also has dozens of functions that are contained in the function libraries. The function libraries are groups of special-purpose functions that extend the capability of Dexterity. For instance, the WinHelp function library contains functions used to implement an online help system for a Dexterity application.
You can also create your own functions for use in scripts. Refer to User-defined Functions for more information.