PreviousActiveX Controls Guide (9.1 revision 1) Next

IndexList

Show this topic in Library frames

Applies to:

VAccess

Sets or returns a variant array containing information on the indexes of the current table as specified by DdfPath and TableName.

Remarks

The IndexList property accepts and returns a variant encapsulating a two-dimensional variant array. The first subscript references one property of the index segment, and the second references the index segment ordinal. The properties referenced by the first subscript are:

Subscript
Name
Variant Type
Description
0
IndexName
VT_BSTR
Unique name for the index, 20 characters max storage limit.
1
IndexNum
VT_I2
Index number (ordinal).
2
SegNum
VT_I2
Sequence number of this segment within the index.
3
FieldName
VT_BSTR
Name of the field indexed by this segment. 20 characters max.
4
Flags
VT_I2
Index attribute bit flags (follows Btrieve key flag specification).

Index attributes are also associated with a physical data file. Setting this property may be used to define indexes in the dictionary, but does not modify the index attributes of the physical data file. Index attributes of existing data files may be modified using DdfAddIndex, DdfDropIndex, and DdfDropIndexMaintain methods.

If RefreshLocations is set to True, reading IndexList will cause the VAccess to re-read the DDF files and get the field information stored in the DDF. Changing IndexList with RefreshLocations set to True will no longer cause all changes to be immediately written to the DDF Files themselves. You must now call DdfAddIndex, DdfDropIndex or DdfDropIndexMaintain to actually write the changes to the DDF files. This is a change in behavior since the release of Pervasive.SQL 2000 SDK. If RefreshLocations is False, IndexList operations will read and update the VAccess control's memory image of the indexes.

If DdfTransactionMode and RefreshLocations are both set to True, all manipulations of IndexList will occur within a transaction.

If DdfKeyUseIndexDdfOnly is set to True, then the IndexList property will always reflect only what is in the DDF. If DdfKeyUseIndexDDFOnly is False, IndexList will get the correct index information from the status buffer each time the index information is refreshed and use the DDF for information not kept in the status buffer.

Example

Dim indexes as Variant 
'Get the indexes from index.ddf 
VAEngine.DdfKeyUseIndexDDFOnly = True 
VAEngine.RefreshLocations = True 
VAEngine.TableName = tableName 
'get indexes from the DDF 
indexes = VAEngine.IndexList 
VAEngine.RefreshLocations = False 
'show index info in list box 
List1.Clear 
If Not IsEmpty(indexes) Then 
  For i = 0 to Ubound(indexes,2) 
    Temp = "" 
    For j = 0 to Ubound(indexes, 1) 
      Temp = Temp + CStr(indexes(j, i)) + vbTab 
    Next j 
    List1.AddItem Temp 
  Next i 
End If 
'get indexes from the data file 
VAEngine.RefreshLocations = True 
VAEngine.DdfKeyUseIndexDDFOnly = False 
VAEngine.TableName = tableName 
TrueIndexes = VAEngine.IndexList 
VAEngine.RefreshLocations = False 
List1.AddItem "------------------------" 
'show index info in list box 
List1.Clear 
If Not IsEmpty(indexes) Then 
  For i = 0 to Ubound(indexes,2) 
    Temp = "" 
    For j = 0 to Ubound(indexes, 1) 
      Temp = Temp + CStr(indexes(j, i)) + vbTab 
    Next j 
    List1.AddItem Temp 
  Next i 
End If 

See Also

Affected by: RefreshLocations, DdfPath, TableName, DdfTransactionMode


Chapter contents
Publication contents

Prev topic: IncludeCurrent
Next topic: IndexNumber