Logo

Hacker’s Guide to Visual FoxPro
An irreverent look at how Visual FoxPro really works. Tells you the inside scoop on every command, function, property, event and method of Visual FoxPro.

ISBLANK()

ISBLANK() indicates whether a passed expression is blank, as distinguished from empty.

Usage

lReturnValue = ISBLANK( eExpression )

This function was added in FoxPro 2.6 for dBASE compatibility. It represents an approach that’s sort of halfway to real nulls.

Blank is that pristine condition you see for numbers or logicals in a Browse until you actually store some data in that field. Blanks are of limited utility because they can’t be distinguished from emptiness for character and date types. With the addition of true nulls in Visual FoxPro, we can’t see any reason to use blanks anymore. Even if the possibility of using a four-state logical field is attractive at first, you’ll find coding and processing blanks to be far more work than it is worth.

The BLANK command lets you reset fields to blank.

Example

CREATE TABLE Test (cfld C(3), dfld D, nfld N(3), lfld L)
* add a record
APPEND BLANK
? ISBLANK(cfld)   && returns .T.
? ISBLANK(dfld)   && returns .T.
? ISBLANK(nfld)   && returns .T.
? ISBLANK(lfld)   && returns .T.

* now store empty values in it
REPLACE cfld WITH "", ;
    dfld WITH {}, ;
    nfld WITH 0, ;
    lfld WITH .f.

? ISBLANK(cfld)   && returns .T.
? ISBLANK(dfld)   && returns .T.
? ISBLANK(nfld)   && returns .F.
? ISBLANK(lfld)   && returns .F.

See Also

Blank, Empty(), IsNull()