Found()

This function reports on the success of various search commands. It's affected by LOCATE, CONTINUE, SEEK, SEEK(), INDEXSEEK(), relations and the antique FIND command.

Usage

lFoundMatch = FOUND( [ cAlias | nWorkArea ] )
FOUND() is maintained separately for each work area and always reflects the most recent search there. If you need to hang on to the result, it's wise to store it to a variable before proceeding.LOCATE, CONTINUE, SEEK, SEEK(), INDEXSEEK() and FIND all affect FOUND() pretty much the same way. You issue one of those commands, and FOUND() returns .T. if the command was successful and .F. otherwise. (Interestingly, KEYMATCH() doesn't update FOUND().) On the whole, we think it's a better choice to check IF FOUND() after a search than to use IF EOF(), as many folks who've been using Xbase for a long time do. Not only is IF FOUND() easier to read and understand, but it also avoids any possible issues with a search using SET NEAR or one that's limited in some way and, therefore, doesn't move the record pointer to end-of-file. The subtle case is using FOUND() with a relation. When a temporal relation has been established (with SET RELATION), you can check FOUND("the child alias") to determine whether a parent record has any children. If it does, FOUND("the child alias") returns .T. You can use this in a filter or FOR clause to affect only parents with child records.

Example

USE Employee ORDER Last_Name
SEEK "FULLER"
? FOUND()       && Returns .T.
SEEK "HOSSENPFEFFER"
? FOUND()       && Returns .F.
 
USE Customer
USE Orders IN 0 ORDER Customer_I
SET RELATION TO Customer_Id INTO Orders
* look at all customers without orders
BROW FOR NOT FOUND("Orders")

See Also

Continue, Find, IndexSeek(), KeyMatch(), Locate, Seek, Seek(), Set Near, Set Relation


Back to Table of Contents

Copyright © 2002-2018 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. Click for license .