ISBLANK( ) Function
Determines whether an expression is blank.
ISBLANK(eExpression)
Parameters
- eExpression
Specifies the expression for ISBLANK( ) to evaluate. eExpression can be a field in a table, a variable or array element, or an expression.
Return Value
Logical. ISBLANK( ) returns True (.T.) if the expression eExpression is blank; otherwise, ISBLANK( ) returns False (.F.).
ISBLANK( ) returns True (.T.) for fields when those fields contain certain values. The following table lists the values that field types contain for ISBLANK( ) to return True.
Data type |
Values the field contains |
---|---|
Blob |
Empty (0h) or contains only zero bytes, for example, 0h00, 0h000000, and so on |
Character |
Empty string, spaces, or no value, such as a newly appended blank record or cleared with BLANK |
Date |
Blank date ({ / / }) or no value, such as a newly appended blank record or cleared with BLANK |
DateTime |
Blank datetime ({ / / : : }) or no value, such as a newly appended blank record or cleared with BLANK |
Float |
No value, such as a newly appended blank record or cleared with BLANK |
General |
Empty, for example, no OLE object |
Logical |
No value, such as a newly appended blank record or cleared with BLANK |
Memo |
Empty, for example, no memo contents |
Numeric |
No value, such as a newly appended blank record or cleared with BLANK |
Varbinary |
Empty (0h) or contains only zero bytes, for example, 0h00, 0h000000, and so on |
Note
Expressions with Currency, Integer, or Double type are never blank; therefore, ISBLANK( ) always returns False (.F.) for these expression types.
Remarks
To create a blank record, use the APPEND BLANK and BLANK commands. You can also use BLANK to clear data from fields in a record.
ISBLANK( ) differs from EMPTY( ) and ISNULL( ). For example, EMPTY( ) returns True (.T.) if a character expression evaluates to empty, for example, it contains spaces, tabs, carriage returns, or line feeds. ISBLANK( ) returns True (.T.) if the character expression contains only the empty string ("") or spaces.
Example
In the following example, a table named mytable is created and a blank record is appended. ISBLANK( ) returns True (.T.) because myfield is blank. A value is placed in myfield, and ISBLANK( ) returns False (.F.) because myfield is no longer blank.
CREATE TABLE mytable FREE (myfield C(20))
APPEND BLANK && Add new blank record
CLEAR
? ISBLANK(myfield) && Displays .T.
REPLACE myfield WITH 'John Smith' && Insert a value in the field
? ISBLANK(myfield) && Displays .F.