Searches for the location of the specified element (passed as a clsD3DynamicArray object) in a sorted clsD3DynamicArray.
bValue = object.brLocateSeq( oDynArrayFind, oDynArraySeq, nFound, [ vnAMC], [ vnVMC], [ vnStart])
| Parameter | Description |
|---|---|
| bValue | The return value is a Boolean data type that is True if oDynArrayFind is found in object. |
| object | An object variable that represents a clsD3DynamicArray object that is sorted. |
| oDynArrayFind | A clsD3DynamicArray object that contains the specific element to be found. |
| oDynArraySeq | A clsD3DynamicArray object specifying the sorting sequence of object, as shown in Settings. |
| nFound | A Long indicating the position where oDynArrayFind was found. |
| vnAMC | Optional. A Variant (Integer subtype) specifying the attribute to be searched. |
| vnVMC | Optional. A Variant (Integer subtype) specifying the value to be searched. |
| vnStart | Optional. A Variant (Integer subtype) specifying the first field from which to begin the search. |
Use the following strings (passed as a clsD3DynamicArray object) to describe the sorting sequence of the clsD3DynamicArray object used as the source:
| Sorting Sequence Parameters | Description |
|---|---|
| al | Ascending, Left-justified |
| ar | Ascending, Right-justified |
| dl | Descending, Left-justified |
| dr | Descending, Right-justified |
The brLocateSeq method provides the same functionality as brLocate, but assumes that the clsD3DynamicArray object is sorted.
This method has the same functionality as brLocateStrSeq. The difference between the two methods is the way the element to be located and the sorting sequence are passed. In the brLocateSeq method, both the element to be located and the sorting sequence are passed as clsD3DynamicArray objects (oDynArrayFind and oDynArraySeq). In the brLocateStrSeq method, these parameters are passed as strings.
Sub Main()
Dim oEnv As New clsD3Environment
Dim oConn As clsD3Connection
Dim oArray As New clsD3DynamicArray
Dim oContinent As New clsD3DynamicArray
Dim oSeq As New clsD3DynamicArray
Dim lFound As Long
Set oConn = oEnv.brOpenConnection("ODBC", "production")
oArray.brCString = "Europe" & D3VMChr & "South America" & D3VMChr & "Africa"
Set oArray = oConn.brSort(oArray)
oContinent.brCString = InputBox("Enter a continent")
oSeq.brCString = "al"
If oArray.brLocateSeq(oContinent, oSeq, lFound, 1) = True Then
MsgBox oContinent.brCString & " is already there."
Else
oArray.brInsertStr oContinent.brCString, 1, lFound
End If
MsgBox oArray.brCString
oEnv.brCloseConnection oConn
Set oArray = Nothing
Set oContinent = Nothing
Set oSeq = Nothing
Set oEnv = Nothing
End Sub
locate