Blois Posted August 19, 2019 Posted August 19, 2019 Guys, I need some help. I have 1 2D Array where I need to validate if some items are duplicates but with some particulars. The default of Array is: Chamado= 123 Contact = No Communication = No Chamado= 124 Contact = No Communication = No Chamado = 123 Contact = No Communication = Yes I need to validate if the Chamado item is duplicate, if so I must delete the first item of it because the last one is the most current. I created as below but is giving error. Func Valida_Duplicados_Array(Const ByRef $aArray) Local $aArray_TEMP = $aArray _ArrayDelete($aArray_TEMP, 0) For $i = 1 To $aArray[0][0] Step 1 Local $compare = $aArray[$i][1] For $a = 1 To $aArray[0][0] Step 1 If $a >= UBound($aArray_TEMP, 1) Then ExitLoop EndIf Local $compare2 = $aArray_TEMP[$a][1] If $compare = $compare2 And $compare <> "SIM" And $compare <> "NÃO" Then If $i >= 1 Then $i -= 1 For $h = 1 To 3 _ArrayDelete($aArray_TEMP, $a) Next ExitLoop _ArrayDisplay($aArray_TEMP) EndIf Next MsgBox(0,"$i - 1 for", $i) Next _ArrayColDelete($aArray_TEMP, 0) Return $aArray_TEMP EndFunc ;==>Valida_Duplicados_Array This is erasing more than the items it should.
Subz Posted August 19, 2019 Posted August 19, 2019 Just use _ArrayFindAll then delete all of them except the last entry, you can do this by reversing the loop and skipping the first item.
jchd Posted August 19, 2019 Posted August 19, 2019 @Blois, how is your input 2D array organized? Fill in sample entries: Local $a = [ _ [col1, col2, col3], _ ; row 0 [col1, col2, col3], _ ; row 1 [col1, col2, col3], _ ; row 2 [col1, col2, col3] _ ; row N ] This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)
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