kctvt Posted May 31, 2024 Posted May 31, 2024 (edited) Hi guys, I have an array as the picture. I want to find exactly location of cell with infomation "Col 3 = 50$" and "Col 15 = Waiting". And, if array have 500.000 row, this code is still working ? Edited May 31, 2024 by kctvt
AspirinJunkie Posted May 31, 2024 Posted May 31, 2024 5 minutes ago, kctvt said: I want to find exactly location of cell with infomation "Col 3 = 50$" and "Col 15 = Waiting". Simply iterate over all elements (code only from the head - without testing): ; your array definition $aData = .... For $i = 0 To Ubound($aData) - 1 If $aData[$i][3] = "50$" And $aData[$i][15] = "Waiting" Then MsgBox(0, "Found", "Row number: " & $i) ExitLoop EndIf Next 6 minutes ago, kctvt said: And, if array have 500.000 row, this code is still working ? It runs - but is correspondingly slow. If you sort by one of the two columns, you could use a modified BinarySearch to speed up the whole thing significantly. Or you create an index that holds the search values in 2 columns and in a 3rd the row number in your output array. The whole thing sorts by the first two columns. You can then perform a binary search again, which works very quickly. But basically you should forget all this because, if I look at the data and its size, a database-based solution would probably be the best approach for you. AutoIt already includes support for SQLite.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now