Author Topic: ArraySearch question: Insure I find duplicate instance with lowest row index?  (Read 2061 times)

mcjathan

  • Newbie
  • *
  • Posts: 40
I have a question regarding ArraySearch(Arry, value, options, search_column).  In my case, I have a 2-dimensional array, and I'm searching for specific values in search_column.  I may have duplicate search values.

The documentation says this regarding duplicates:

Duplicates

This function will not necessarily locate the item with the lowest index of a set of duplicates. To find every occurrence of a duplicate value, you must search in both directions from the first found item. A linear search is the preferred method to find every occurrence of a value, unless you have a very large data set.


I understand how this applies to the binary search options (1 & 3), but what about the linear search options (0 & 2)?  If I specify a linear search, will I be guaranteed to find the duplicate with the lowest row index or not?

Regards,

Jeff

td

  • Tech Support
  • *****
  • Posts: 3210
    • WinBatch
Assuming you start your search on the first row of a rank 2 array, it will find a matching element in your targeted column with the lowest row index first. 
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

mcjathan

  • Newbie
  • *
  • Posts: 40
Thank you!