Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- CA-Clipper 5.2 . The Guide To CA-Clippe - <b>empty()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 EMPTY()
 Determine if the result of an expression is empty
------------------------------------------------------------------------------
 Syntax

     EMPTY(<exp>) --> lEmpty

 Arguments

     <exp> is an expression of any data type.

 Returns

     EMPTY() returns true (.T.) if the expression results in an empty value;
     otherwise, it returns false (.F.).  The criteria for determining whether
     a value is considered empty depends on the data type of <exp> according
     to the following rules:

     List of Empty Values
     ------------------------------------------------------------------------
     Data Type    Contents
     ------------------------------------------------------------------------
     Array        Zero-length
     Character    Spaces, tabs, CR/LF, or ("")
     Numeric      0
     Date         Null(CTOD(""))
     Logical      False (.F.)
     Memo         Same as character
     NIL          NIL
     ------------------------------------------------------------------------

 Description

     The EMPTY() function has a number of uses.  You can use it to determine
     if a user entered a value into a GET object before committing changes to
     a database file.  It can also determine whether a formal parameter is
     NIL or unsupplied.  In addition, it can test an array for zero-length.

 Examples

     .  These examples illustrate use of EMPTY() against several
        different data types:

        ? EMPTY(SPACE(5)), EMPTY("")        // Result: .T. .T.
        ? EMPTY(0), EMPTY(CTOD(""))         // Result: .T. .T.
        ? EMPTY(.F.), EMPTY(NIL)            // Result: .T. .T.

     .  This example uses EMPTY() to determine whether the user
        entered a value into the first Get object before writing the new
        value to the database file:

        LOCAL cCust := SPACE(15), nAmount := 0
        USE Sales NEW
        @ 10, 10 GET cCust
        @ 11, 10 GET nAmount PICTURE "999.99"
        READ
        //
        IF !EMPTY(cCust)
           APPEND BLANK
           REPLACE Sales->Cust WITH cCust, Sales->Amount ;
              WITH nAmount
        ENDIF

     .  This example uses EMPTY() as part of the VALID clause to force
        the user to enter data into the current Get object:

        LOCAL cCode := SPACE(5)
        @ 2, 5 SAY "Enter code" GET cCode VALID !EMPTY(cCode)
        READ

 Files:  Library is CLIPPER.LIB.

See Also: LEN()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson