Using Functions

A function is a special form of an expression that performs a complex calculation or action before returning its value.

Example:

 

Functions expand the scope of what a PracticeScript expression can tell you. Using a function such as "Today()" combined with a comparison operator such as "=" enables you to find out if certain transactions were posted on the current date. The PracticeScript variable Ledger.SvcDate represents the service date of a ledger transaction.

The expression: Ledger.SvcDate = Today() evaluates to TRUE (1) if the transaction contains the current date.

The syntax of a function is similar to that of a variable. It differs from a variable in that it is always followed immediately by an expression, or parameter, enclosed in parentheses. A parameter supplies the information that a function uses to make its calculation. Some functions have optional parameters.

Example:

 

If you use a numerical expression that represents a different date, the function evaluates to the first of the month of the alternative date.

Example:

 

 

Related Topics

Function Definitions

Practice Answers

Date Functions

Special Functions

Strings Functions

Time Functions

User Defined Functions

Prompt User for Info Functions