C5_SEEK

 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 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



Advertisements

7 responses to “C5_SEEK

  1. Pingback: C5DG-3 RDD Reference | Viva Clipper !

  2. Pingback: C5_SKIP | Viva Clipper !

  3. Pingback: C5_SET UNIQUE | Viva Clipper !

  4. Pingback: C5_SET SOFTSEEK | Viva Clipper !

  5. Pingback: C5_SET ORDER | Viva Clipper !

  6. Pingback: DB Commands | Viva Clipper !

  7. Pingback: C5 Commands | Viva Clipper !

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.