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>found()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 FOUND()
 Determine if the previous search operation succeeded
------------------------------------------------------------------------------
 Syntax

     FOUND() --> lSuccess

 Returns

     FOUND() returns true (.T.) if the last search command was successful;
     otherwise, it returns false (.F.).

 Description

     FOUND() is a database function that determines whether a search
     operation (i.e., FIND, LOCATE, CONTINUE, SEEK, or SET RELATION)
     succeeded.  When any of these commands are executed, FOUND() is set to
     true (.T.) if there is a match; otherwise, it is set to false (.F.).

     If the search command is LOCATE or CONTINUE, a match is the next record
     meeting the scope and condition.  If the search command is FIND, SEEK or
     SET RELATION, a match is the first key in the controlling index that
     equals the search argument.  If the key value equals the search
     argument, FOUND() is true (.T.); otherwise, it is false (.F.).

     The value of FOUND() is retained until another record movement command
     is executed.  Unless the command is another search command, FOUND() is
     automatically set to false (.F.).

     Each work area has a FOUND() value.  This means that if one work area
     has a RELATION set to a child work area, querying FOUND() in the child
     returns true (.T.) if there is a match.

     By default, FOUND() operates on the currently selected work area.  It
     can be made to operate on an unselected work area by specifying it
     within an aliased expression (see example below).

     FOUND() will return false (.F.) if there is no database open in the
     current work area.

 Examples

     .  This example illustrates the behavior of FOUND() after a
        record movement command:

        USE Sales INDEX Sales
        ? INDEXKEY(0)              // Result: SALESMAN
        SEEK "1000"
        ? FOUND()                  // Result: .F.
        SEEK "100"
        ? FOUND()                  // Result: .T.
        SKIP
        ? FOUND()                  // Result: .F.

     .  This example tests a FOUND() value in an unselected work area
        using an aliased expression:

        USE Sales INDEX Sales NEW
        USE Customer INDEX Customer NEW
        SET RELATION TO CustNum INTO Sales
        //
        SEEK "Smith"
        ? FOUND(), Sales->(FOUND())

     .  This code fragment processes all Customer records with the key
        value "Smith" using FOUND() to determine when the key value changes:

        USE Customer INDEX Customer NEW
        SEEK "Smith"
        DO WHILE FOUND()
           .

           . <statements>
           .
           SKIP
           LOCATE REST WHILE Name == "Smith"
        ENDDO

 Files   Library is CLIPPER.LIB.


See Also: CONTINUE EOF() LOCATE SEEK SET RELATION

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