brCreateIndex method

Creates an index for the D3 file using the specified a-correlative.

Syntax

bValue = object.brCreateIndex(sCorrelative, bOverwrite, [bEntirety], [vlRecords])

Parameters

Parameter Description
bValue The return value is a Boolean data type that is True if successful.
object An object variable that represents a clsD3File object.
sCorrelative A String containing an a-correlative.
bOverwrite A Boolean set to True to overwrite an existing index.
bEntirety Optional. Not implemented.
vlRecords Optional. Not implemented.

Example

Sub Main()
   Dim oEnv As New clsD3Environment
   Dim oConn As clsD3Connection
   Dim oFile As clsD3File
   Dim oIndex As clsD3Index
 
   Set oConn = oEnv.brOpenConnection("ODBC", "Production") 
   Set oFile = oConn.brOpenFile("customers")
 
   On Error GoTo D3ErrorHandler
 
   ' If there is not an existing index on attribute 1,
   ' then the D3ErrorHandler will create an index.
   Set oIndex = oFile.brRoot("a1")
 
   ' brMoveNext is the first index function to
   ' be performed so the index will be traversed
   ' from the beginning.
   Do While oIndex.brMoveNext
      ' brIndexId returns the item-ids from the
      ' customers file that is the customerid.
      ' brIndexKey returns the customer's name (attribute1).
      Debug.Print oIndex.brIndexId, oIndex.brIndexKey
   Loop
 
   oConn.brCloseFile oFile
   oEnv.brCloseConnection oConn
   Set oEnv = Nothing
Exit Sub
 
D3ErrorHandler:
   Select Case Err.Number
      Case d3SrvErr_NotRoot
         oFile.brCreateIndex"a1", True
      Case Else
      End
   End Select
   Resume
End Sub

TCL reference

create-index

Applies to

clsD3File class