musahi0128 Posted February 27, 2022 Posted February 27, 2022 (edited) Hi guys, Supposed i have this array I need to call a function after row 0, row 1, and row 4. Simply put I need to call a function if the data on col 5 next row is different from current data. My current code is as follow. It works for row 0 and row 1 but it fail for row 4 with error "Array variable has incorrect number of subscripts or subscript dimension range exceeded" For $a = 0 To UBound($aQuery) -1 If BitOR($a = UBound($aQuery)-1, $aQuery[$a][5] <> $aQuery[$a + 1][5]) Then ; call a function here EndIf Next I know the error is to be expected, but I can't think of other way to approach my needs. Any idea how to approach it? Thanks! Edited February 27, 2022 by musahi0128 Correction on how to explain my needs
Nine Posted February 27, 2022 Posted February 27, 2022 Maybe something like this : Local $iPrev For $a = UBound($aQuery) - 1 To 0 Step -1 If $iPrev <> $aQuery[$a][5]) Then $iPrev = $aQuery[$a][5] ; call a function here EndIf Next “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
ad777 Posted February 27, 2022 Posted February 27, 2022 (edited) @musahi0128 this should works without error: For $a = 0 To UBound($aQuery) -2 If BitOR($a = UBound($aQuery)-1, $aQuery[$a][5] <> $aQuery[$a + 1][5]) Then ; call a function here EndIf Next Edited February 27, 2022 by ad777 none
Solution musahi0128 Posted February 27, 2022 Author Solution Posted February 27, 2022 1 hour ago, ad777 said: @musahi0128 this should works without error: For $a = 0 To UBound($aQuery) -2 If BitOR($a = UBound($aQuery)-1, $aQuery[$a][5] <> $aQuery[$a + 1][5]) Then ; call a function here EndIf Next Yes it's eliminate the error but also skip the last step. But then this is giving me the inspiration I needed, Just add one empty row to the array and bam, it works! Thanks dude, love you hahaha
Nine Posted February 27, 2022 Posted February 27, 2022 1 hour ago, musahi0128 said: Just add one empty row to the array and bam, it works! It is like applying a band-aid over a headache. Did you even try my proposal ? “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
musahi0128 Posted February 27, 2022 Author Posted February 27, 2022 1 minute ago, Nine said: It is like applying a band-aid over a headache. Did you even try my proposal ? I don't bro, my brain isn't working right right now wkwkwk After adding an empty row to the array and changing to UBound()-2 it just works for me. And your proposal seems to count the value backward, is that right ?
Nine Posted February 27, 2022 Posted February 27, 2022 Just now, musahi0128 said: And your proposal seems to count the value backward, is that right ? Rigth, so what is the problem with that ? “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
musahi0128 Posted February 27, 2022 Author Posted February 27, 2022 2 minutes ago, Nine said: Rigth, so what is the problem with that ? Well, i still need it to run forward
Nine Posted February 27, 2022 Posted February 27, 2022 Just now, musahi0128 said: Well, i still need it to run forward That is a well explained argument. And probably has nothing with reality. Let me say, that paradigm is a dangerous tangent against intelligence. Good luck anyway. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
musahi0128 Posted February 27, 2022 Author Posted February 27, 2022 1 minute ago, Nine said: That is a well explained argument. And probably has nothing with reality. Let me say, that paradigm is a dangerous tangent against intelligence. Good luck anyway. I don't get what you are saying but thanks !
spudw2k Posted February 28, 2022 Posted February 28, 2022 @Nine Patient and friendly as usual. Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF
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