Functions

Overview

DbfScript comes with a variety of functions that can be invoked from your scripts.

To invoke a function, simply put the name of the function, and any parameters that are passed to that function in parentheses. If the function returns a value, you can put that function call where you would normally put an expression. If the function does not return a value, then first put "call" followed by the function call.

Some function have a namespace prefixed, followed by a colon.

For example, to call the str:MakeIdentifier function, you would put:

var #id = str:MakeIdentifier("This is a test")

In this case, the text "This is a test" is a parameter.

If you were invoking a function that does not return a value, you would put:

call Sleep(1000)

...which invokes the Sleep function, for 1000 milliseconds (1 second).

In this section we describe the functions available in DbfScript. There are over 250 of them, and they are grouped according to their function.

In each case the function is described as follows:

ReturnType FunctionName(ParameterType Parameter, ...)

Each description begins with a ReturnType, which is the type of the data returned by the function. If this is omitted it means the function doesn't return anything. The following return and parameter types are mentioned:


  • NoReturn: The function has no return, it should be invoked with "call".

  • Any: Could be more than one type of data. For example, may return a number or a string.

  • Number: A number.

  • Boolean: A true/false boolean.

  • String: A text string.

  • DateTime: A date/time value.

  • FileData: A file object.

  • Record: A single record.

  • List: A list of records.

  • RecordOrList: A record or a list of records.

  • StringList: A list of text strings. Use loop through with this.

  • XPath: A path.

  • CPath: A path component (path item).

FunctionName is the name of the function. ParameterType is the type of the parameter (described above), followed by Parameter which is the short name given to the parameter.

Functions can have any number of parameters.

Next Topic: General Functions


Please post all questions on the support forum. Thank you.