DBSEEK()
Searches for a value based on an active index.
Syntax
DBSEEK(<expKey>, [<lSoftSeek>],[<lFindLast>]) --> lFound
Arguments
<expKey> Any expression
<lSoftSeek> Toggle SOFTSEEK condition
<lFindLast> is an optional logical value that set the current record position to the last record if successful
Returns
DBSEEK() returns logical true (.T.) if found, otherwise false
Description
This function searches for the first record in a database file whose index key matches <expKey>. If the item is found, the function will return a logical true (.T.), the value of FOUND() wilI be a logical true (.T.), and the value of EOF() wilI be a logical false (.F.). If no item is found. then the function will return a logical false, the value of FOUND( ) will be a logical false (.F.), and the value of EOF( ) will be a logical true (.T.).
This function always “rewinds” the database pointer and starts the search from the top of the file.
If the SOFTSEEK flag is on or if <lSoftSeek> is set to a logical true (.T.) the value of FOUND() will be a logical false and EOF() will be false if there is an item in the index key with a greater value than the key expression <expKey>; at this point the record pointer will position itself on that record. However, if there is no greater key in the index, EOF() will return a logical true (.T.) value. If <lSoftSeek> is not passed, the function will look to the internal status of SOFTSEEK before performing the operation. The default of <lSoftSeek> is a logical false (.F.)
Examples
PROCEDURE Main() USE tests NEW INDEX tests DBGOTO( 10 ) nId := tests->nId IF tests->( DBSEEK( nId ) ) IF RLOCK() ? tests->Name DBRUNLOCK() ENDIF ENDIF USE RETURN ACCEPT "Employee name: " TO cName IF Employee->( DBSEEK( cName ) ) Employee->( ViewRecord() ) ELSE ? "Not found" ENDIF
Compliance
DBSEEK() is Compatible with CA-Cl*pper 5.3
Files
Library is rdd
Seealso
DBGOBOTTOM(), DBGOTOP(), DBSKIP(), EOF(), BOF(), FOUND()
Pingback: Harbour All Functions – D | Viva Clipper !
Pingback: Harbour Database Functions | Viva Clipper !
Pingback: Harbour RG Summary | Viva Clipper !