SEEK

From Lianjapedia
Jump to: navigation, search

Purpose

Search for specified key in the master index and if found, position the record pointer in the table

Syntax

SEEK <key expression>

See Also

DBXDESCEND(), DESCEND(), DESCENDING(), DTOS(), EOF(), INDEX, FOUND(), KEY(), KEYMATCH(), LTOS(), REFERENCES(), SEEK(), SET EXACT, STR()

Description

The SEEK command is identical to the FIND command, except that you can specify any valid expression as the key without the need to use macros. The SEEK command looks up the specified key in the master index file. If the key is found, then the FOUND() function will return .T., and the EOF() function will return .F.. If the key is not found, then the FOUND() function will return .F., and the EOF() function will return .T..

In the Lianja/4GL, you can build indexes on any data type or any combination of data types. The conversion functions STR(), DTOS() and LTOS() are used to build indexes on mixed data types. The DESCEND() function can also be used to build indexes in descending key order. If the DESCEND() function is used to create the index key, it must also be used in the search <key expression>. Tag indexes built with the DESCENDING keyword require the use of the DBXDESCEND() function in the <key expression>. The DESCENDING() function can be used to determine whether a particular tag was built with the DESCENDING keyword.

If SET EXACT is OFF, then partial keys will be matched. If SET EXACT is ON, then only complete keys will be matched.

Example

use patrons
index on event to events
seek "BALLET"
 
index on date to dates
seek ctod("01/01/2000")
 
index on dtos(eventdate) + "/" + event to dates
seek "20010101/BALLET"