Compartir a través de


FOUND( ) Function

Returns true (.T.) if CONTINUE, FIND, INDEXSEEK( ), LOCATE, or SEEK is successful.

FOUND([nWorkArea | cTableAlias])

Return Values

Logical

Parameters

  • nWorkArea
    Specifies the work area of the table for which FOUND( ) returns a value indicating the success of the last CONTINUE, FIND, INDEXSEEK( ), LOCATE, or SEEK.

    FOUND( ) returns false (.F.) if a table isn't open in the work area you specify.

  • cTableAlias
    Specifies the alias of the table for which FOUND( ) returns a value indicating the success of the last CONTINUE, FIND, INDEXSEEK( ), LOCATE, or SEEK.

    Visual FoxPro generates an error message if you specify a table alias that doesn't exist.

Remarks

FOUND( ) returns a logical value that indicates whether the most recently executed CONTINUE, FIND, INDEXSEEK( ), LOCATE, or SEEK was successful, or if the record pointer was moved in a related table. FOUND( ) returns true (.T.) if the search is successful; otherwise FOUND( ) returns false (.F.).

If you omit the optional arguments, FOUND( ) returns a value indicating the success of the last CONTINUE, FIND, INDEXSEEK( ), LOCATE, or SEEK for the table open in the currently selected work area.

Tip   This function can be used to determine if a child table has a record that matches the parent record.

Examples

In the following example, all customers from Germany are counted.

SET TALK OFF
CLOSE DATABASES
OPEN DATABASE (HOME(2) + 'Data\testdata')
USE customer  && Opens Customer table

STORE 0 TO gnCount
LOCATE FOR UPPER(country) = 'GERMANY'
DO WHILE FOUND( )
   gnCount = gnCount + 1
   CONTINUE
ENDDO
WAIT WINDOW 'Total customers from Germany: ' ;
   + LTRIM(STR(gnCount)) NOWAIT

See Also

CONTINUE | EOF( ) | FIND | INDEXSEEK( ) | LOCATE | SEEK