XArrayDB Reference > XArrayDB Methods > Find Method (XArrayDB) |
The Find method searches for a specified value within a column of an XArrayDB object, starting at a particular row.
XArrayDB.Find (row, column, value, [order], [comparison], [type])
row is a long integer specifying the starting row of the search.
column is a long integer specifying the column to be searched.
value is a variant specifying the value to search for.
order is an XORDER constant that specifies the direction of the search. If omitted, XORDER_ASCEND is assumed.
comparison is an XCOMP constant that specifies the kind of comparison to be performed. If omitted, XCOMP_EQ is assumed.
type is an XTYPE constant that specifies the data type used to coerce column values during comparison. If omitted, XTYPE_DEFAULT is assumed, which means that the data type of the value argument is used.
A long integer corresponding to the index of the next row that contains a matching value. If no match is found, the value returned is one less than the lower bound for rows specified in the previous call to the ReDim method.
If a match is found, this method returns the corresponding row index; otherwise, the value returned is equal to:
The following example demonstrates the use of the Find method on a single-column XArrayDB object containing long integers:
' Search for the value 200. Prints 3.
Debug.Print MyArray.Find(1, 1, 200)
' Search for a value less than 200.
Debug.Print MyArray.Find(1, 1, 200, , XCOMP_LT) ' prints 1