Condividi tramite


ISBLANK( ) Function

Determines whether an expression is blank.

ISBLANK(eExpression)

Return Values

Logical

Parameters

  • eExpression
    Specifies the expression that ISBLANK( ) evaluates. eExpression can be a field in a table, a variable or array element, or an expression.

    For a field, ISBLANK( ) returns true (.T.) if the field contains the following values.

    Type Contents
    Character Empty string, spaces, or no value (newly appended blank record or cleared with BLANK)
    Numeric No value (newly appended blank record or cleared with BLANK)
    Float No value (newly appended blank record or cleared with BLANK)
    Date Blank date ({ / / }) or no value (newly appended blank record or cleared with BLANK)
    DateTime Blank datetime ({ / / : : }) or no value (newly appended blank record or cleared with BLANK)
    Logical No value (newly appended blank record or cleared with BLANK)
    Memo Empty (no memo contents)
    General Empty (no OLE object)
    Picture Empty (no picture)

Remarks

ISBLANK( ) returns true (.T.) if the expression eExpression is blank; otherwise, ISBLANK( ) returns false (.F.).

APPEND BLANK and BLANK are used to create a blank record. BLANK can also be used to clear data from fields in a record. ISBLANK( ) can determine if a field is blank.

Note that Currency, Integer and Double type expressions are never blank, and ISBLANK( ) always returns false (.F.) for these data types.

ISBLANK( ) differs from EMPTY( ) and ISNULL( ). For example, EMPTY( ) returns true (.T.) if a character expression contains any combination of null values, spaces, tabs, carriage returns, or line feeds; ISBLANK( ) returns true (.T.) if a 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.

See Also

APPEND | BLANK | EMPTY( ) | ISNULL( ) | LEN( )