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.


4 responses to “C5_FOUND

  1. Pingback: C5_SET SOFTSEEK | Viva Clipper !

  2. Pingback: C5_SET RELATION | Viva Clipper !

  3. Pingback: C5_LOCATE | Viva Clipper !

  4. Pingback: C5 Index Commands and Functions | 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.