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.3 . Guide To CA-Clipper - <b>seek</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 SEEK
 Search an order for a specified key value
------------------------------------------------------------------------------
 Syntax

     SEEK <expSearch> [SOFTSEEK]

 Arguments

     <expSearch> is an expression to match with an order key value.

     SOFTSEEK causes the record pointer to be moved to the next record
     with a higher key value after a failed order search.  Default behavior
     moves the record pointer to EOF() after a failed order search.

 Description

     SEEK is a database command that searches the controlling order from the
     first or last key value (depending on whether the LAST keyword is
     specified) and proceeds until a match is found or there is a key value
     greater than <expSearch>.  If there is a match, the record pointer is
     positioned to the identity found in the order.  If SOFTSEEK is OFF (the
     default) and SEEK does not find a match, the record pointer is
     positioned to LASTREC() + 1, EOF() returns true (.T.), and FOUND()
     returns false (.F.).

     SOFTSEEK enables a method of searching an order and returning a record
     even if there is no match for a specified key.

     When SOFTSEEK is ON and a match for a SEEK is not found, the record
     pointer is set to the next record in the order with a higher key value
     than the SEEK argument.  Records are not visible because SET FILTER
     and/or SET DELETED are skipped when searching for the next higher key
     value.  If there is no record with a higher key value, the record
     pointer is positioned at LASTREC() + 1, EOF() returns true (.T.), and
     FOUND() returns false (.F.).  FOUND() returns true (.T.) only if the
     record is actually found.  FOUND() never returns true (.T.) for a
     relative find.

     When SOFTSEEK is OFF and a SEEK is unsuccessful, the record pointer is
     positioned at LASTREC() + 1, EOF() returns true (.T.), and FOUND()
     returns false (.F.).

     SEEK with the SOFTSEEK clause is, effectively, the same as performing
     SET SOFTSEEK and then SEEK in earlier versions of CA-Clipper except that
     it does not change the global setting of SOFTSEEK.

 Examples

     .  The following example searches for "Doe" using the SEEK
        command:

        USE Customer NEW
        SET ORDER TO Customer
        ? SET( _SET_SOFTSEEK )      // (.F.)
        SEEK "Doe"
        ? SET( _SET_SOFTSEEK )      // Still (.F.)
        IF FOUND()
           .
           . < statements >
           .
        ENDIF

     .  The following example performs a soft seek for "Doe" using
        SOFTSEEK clause of the SEEK command:

        USE Customer NEW
        SET ORDER TO Customer
        ? SET( _SET_SOFTSEEK )      // (.F.)
        SEEK "Doe" SOFTSEEK
        ? SET( _SET_SOFTSEEK )      // Still (.F.)
        IF !FOUND()
           ? Customer->Name         // Returns next logical name after "Doe"
        ENDIF

 Files   Library is CLIPPER.LIB.

See Also: DBSEEK() DBSETINDEX() DBSETORDER() EOF() SET INDEX

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