DBSEEK() Move to the record having the specified key value ------------------------------------------------------------------------------ Syntax DBSEEK(<expKey>, [<lSoftSeek>], [<lLast>]) --> lFound Arguments <expKey> is a value of any type that specifies the key value associated with the desired record. <lSoftSeek> is an optional logical value that specifies whether a soft seek is to be performed. This determines how the work area is positioned if the specified key value is not found (see below). If <lSoftSeek> is omitted, the current global _SET_SOFTSEEK setting is used. <lLast> is specified as true (.T.) to seek the last occurrence of the specified key value. False (.F.), the default, seeks the first occurrence. Note: This parameter is only supported for specific RDDs. DBFNTX is NOT one of them. Returns DBSEEK() returns true (.T.) if the specified key value was found; otherwise, it returns false (.F.). Description DBSEEK() moves to the first logical record whose key value is equal to <expKey>. If such a record is found, it becomes the current record and DBSEEK() returns true (.T.); otherwise, it returns false (.F.). the positioning of the work area is as follows: for a normal (not soft) seek, the work area is positioned to LASTREC() + 1 and EOF() returns true (.T.); for a soft seek, the work area is positioned to the first record whose key value is greater than the specified key value. If no such record exists, the work area is positioned to LASTREC() + 1 and EOF() returns true (.T.). For a work area with no active indexes, DBSEEK() has no effect. DBSEEK() performs the same function as the standard SEEK command. For more information, refer to the SEEK command. Notes . Logical records: DBSEEK() operates on logical records which are considered in indexed order. If a filter is set, only records which meet the filter condition are considered. . Controlling order: If the work area has more than one active index, the operation is performed using the controlling order as set by DBSETORDER() or the SET ORDER command. For more information, refer to the SET ORDER command. . Network environment: For a shared file on a network, moving to a different record may cause updates to the current record to become visible to other processes. For more information, refer to the "Network Programming" chapter in the Programming and Utilities Guide. This function will not affect the locked status of any record. Examples . In this example, DBSEEK() moves the pointer to the record in the database, Employee, in which the value in FIELD "cName" matches the entered value of cName: ACCEPT "Employee name: " TO cName IF ( Employee->(DBSEEK(cName)) ) Employee->(VIEWRECORD()) ELSE ? "Not found" END Files Library is CLIPPER.LIB.
See Also: DBGOBOTTOM() DBGOTOP() DBSKIP() EOF() FOUND()
Pingback: C5_SEEK | Viva Clipper !