FOUND( ) Function

JavaScript Editor js editor     Web development 



Main Page

Determines whether the most recently executed CONTINUE, FIND, LOCATE, or SEEK command was successful or if the record pointer was moved in a related table.

Tip:
You can use FOUND(В ) to determine if a child table has a record that matches the parent record.

FOUND([nWorkArea | cTableAlias])

Parameters

nWorkArea


Specifies the work area of the table that the most recent CONTINUE, FIND, LOCATE, or SEEK command was called on.
cTableAlias


Specifies the alias of the table that the most recent CONTINUE, FIND, LOCATE, or SEEK command was called on.
Note:
If you specify a table alias that does not exist, Visual FoxPro generates an error message.

Return Value

Logical. FOUND(В ) returns True (.T.) if the most recent CONTINUE, FIND, LOCATE, or SEEK command was successful; otherwise, it returns False (.F.). If a table is not open in the work area you specify, FOUND(В ) returns False. When FOUND(В ) encounters an end-of-file, which can be determined by the EOF(В ) function, it always returns False.

Remarks

If you call FOUND(В ) without arguments, FOUND(В ) is called on the table open in the currently selected work area.

Examples

The following example locates and counts all customers whose Country field in the Customer table contains "GERMANY". CLOSE DATABASES closes all databases, and OPEN DATABASE opens the sample Visual FoxPro database, TestData.dbc. USE opens the Customer table.

STORE stores a value of 0 in the variable gnCount. LOCATE searches for the first record in which the Country field contains the value "GERMANY". The DO WHILE loop increments the variable gnCount by 1 and uses CONTINUE to perform another LOCATE operation. When there are no more matching records, the total number of customers is displayed.

В Copy Code
CLOSE DATABASES
OPEN DATABASE (HOME(2) + 'Data\TestData')
USE Customer
STORE 0 TO gnCount
LOCATE FOR UPPER(Country)='GERMANY'
DO WHILE FOUND()
   gnCount = gnCount + 1
   CONTINUE
ENDDO
? "Total customers from Germany: "+LTRIM(STR(gnCount))

See Also



JavaScript Editor js editor     Web development