INDICES() |
|
|
The INDICES() function returns information about alternate key indices.
Format
INDICES(file.var) To retrieve a list of indices INDICES(file.var, index.name) To retrieve information for a specific index
where
The first form of the INDICES() function returns a field mark delimited list of alternate key index names for the file referenced via file.var.
The second form of the INDICES() function returns a dynamic array resembling a dictionary record for the index named by the index.name argument. This dynamic array is broadly similar to the original dictionary record used to create the index except that field 1 is extended to include additional flags as a multivalued list and field 5 of a C, D or I-type item contains only L or R as the justification mode.
Interpretation of fields 2 onwards is dependent on the record type. For an A/S-type record that has no correlative in field 8 or for a D-type record, field 2 holds the field number on which the index is based. For a C/I type record, field 2 holds the indexed expression. For an A/S-type record with a correlative, the correlative expression is in field 8.
The sort order of indexed values in the index is determined by the justification code in the dictionary item as returned in field 5 for a C, D or I-type item and field 9 for an A or S-type item.
See the SELECTINDEX statement for an example that describes how an index is sorted.
Example
INDEX.NAMES = INDICES(FVAR) NUM.INDICES = DCOUNT(INDEX.NAMES, @FM) FOR I = 1 TO NUM.INDICES NAME = INDEX.NAMES<I> CRT NAME : ' Type ' : INDICES(FVAR, NAME)[1,1] NEXT I
The above program displays a list of alternate key index names and their type. |