Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- The Guide To Clipper - <b>seek</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
SEEK


Syntax:     SEEK <exp>

Purpose:    To search an index for the first key matching a specified
            expression.

Arguments:  <exp> is an expression to be matched with an index key.

Usage:      SEEK searches the controlling index starting with the first
            key and proceeds until a match is found or there is a key
            value greater than the search argument.  If there is a
            match, the record pointer is positioned to the record number
            found in the index.  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.).  If SOFTSEEK is ON, the record pointer
            is positioned to the record with the first key value greater
            than the search argument and FOUND() returns false (.F.).
            In this case, EOF() only returns true (.T.) if there are no
            keys in the index greater than the search argument.

            Note that SEEK is not affected by SET EXACT.

Library:    CLIPPER.LIB


----------------------------------- Example --------------------------------

   USE Sales INDEX Branch
   ? INDEXKEY(0)                       && Result: BRANCH
   ? Branch                            && Result: 100
   SEEK "100"
   ? FOUND(), EOF(), RECNO()           && Result: .T. .F. 1

   The following user-defined function performs an exact SEEK for
   indexes with character keys returning the result of FOUND():

   FUNCTION SeekExact
   PARAMETERS search_exp
   PRIVATE key_exp

   key_exp = INDEXKEY(0)
   SEEK Pad(search_exp, LEN(&key_exp.))   && Pad() is in EXTEND.LIB

   RETURN (FOUND())


See Also: FIND SET SOFTSEEK EOF() FOUND()

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