[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 Determine if the previous search operation succeeded

     FOUND() --> lSuccess


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


     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.


     .  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.
        ? 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>
           LOCATE REST WHILE Name == "Smith"

 Files   Library is CLIPPER.LIB.

This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson