EMPTY( ) Function

Example   See Also

Determines whether an expression evaluates to empty.

Syntax

EMPTY(eExpression)

Returns

Logical

Arguments

eExpression

Specifies the expression that EMPTY( ) evaluates.

The expression you include can be a character, numeric, date, or logical expression, or the name of a memo or general field in an open table. EMPTY( ) returns true (.T.) when expressions evaluate to the following:

Expression type Evaluates to
Character The empty string, spaces, tabs, carriage returns, linefeeds, or any combination of these.
Numeric 0
Currency 0
Float 0
Integer 0
Double 0
Date Empty (e.g. CTOD(''))
DateTime Empty (e.g. CTOT(''))
Logical False (.F.)
Memo Empty (no contents)
General Empty (no OLE object)
Picture Empty (no picture)

EMPTY( ) cannot be used to determine if a variable object reference is empty. For example, a variable can contain an object reference for a form. If the form is closed by clicking Close from the form's pop-up menu or by issuing CLEAR WINDOWS, the variable contains the null value.

The following program example demonstrates how to use TYPE( ) and ISNULL( ) to determine if a variable object reference is valid.

goMyForm = CREATEOBJECT('Form')
WAIT WINDOW IIF(TYPE('goMyForm') = 'O' AND !ISNULL(goMyForm), ;
   'goMyForm has valid object reference',;
   'goMyForm does not have valid object reference')

Remarks

EMPTY( ) returns true (.T.) if the expression eExpression evaluates to empty; otherwise, EMPTY( ) returns false (.F.).