WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: mcjathan on March 28, 2014, 12:37:33 PM

Title: ArraySearch question: Insure I find duplicate instance with lowest row index?
Post by: mcjathan on March 28, 2014, 12:37:33 PM
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
Title: Re: ArraySearch question: Insure I find duplicate instance with lowest row index?
Post by: td on March 28, 2014, 12:57:05 PM
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. 
Title: Re: ArraySearch question: Insure I find duplicate instance with lowest row index?
Post by: mcjathan on March 28, 2014, 01:33:40 PM
Thank you!