Skip to main content
Previous section   Next section

SELECTINDEX

Selects an index.

Synopsis

SELECTINDEX indexname[,akey] FROM filevar TO varname

Arguments

indexname The name of a defined index, specified as a quoted string.
akey Optional — A specific index key value, specified as a quoted string.
filevar A local variable name assigned to the index file by the OPENINDEX statement.
varname A named select list for an index, created by SELECTINDEX. varname is specified as a variable name.

Description

The SELECTINDEX statement is used to select the unique keys of an index for use by the READNEXT statement. The index must already have been opened using the OPENINDEX statement.

There are three ways to select an index

  • SELECT selects the entire index into a named select list. You then use READNEXT KEY to read individual index items.

  • SELECT ATKEY selects the specified index key into a named select list. You then use READNEXT KEY to read individual index items.

  • SELECTINDEX selects all the unique index keys into a named select list. You then use READNEXT to read individual index items.

Example

OPENINDEX 'VOC','F1' TO idxfp
SELECTINDEX 'F1' FROM idxfp TO idxlist
FOR x=1 TO 5
  READNEXT id FROM idxlist
  PRINT id
NEXT
Copy code to clipboard

See Also