Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

_ArrayUnique on multiple columns

$
0
0

I'm wondering if there is a UDF or a function that can get the distinct values from a 2D array using multiple columns. I'm trying setup an excel output that can be trimmed and the distinct records recorded on the excel spreadsheet.

 

I was messing around with _arrayunique but trying to get the distinct records for multiple columns, but I'm not really getting anywhere. Any suggestions?

 

This is an example of the code:

If $TrimOpt='Op1' then $aWriteVal=_ArrayUnique($AllPro,0) If $TrimOpt='Op2' then $aWriteVal=_ArrayUnique($AllPro,1) If $TrimOpt='Op3' then $aWriteVal=_ArrayUnique($AllPro,2) If $TrimOpt='Op4' then $aWriteVal=_ArrayUnique($AllPro,3) If $TrimOpt='Op5' then $aWriteVal=_ArrayUnique($AllPro,4) If $TrimOpt='Op6' then $aWriteVal=_ArrayUnique($AllPro,5) If $TrimOpt='Op7' then $aWriteVal=_ArrayUnique($AllPro,6) $oExcel = ObjCreate("Excel.Application") $oExcel.Visible = True $oWorkbook=$oExcel.WorkBooks.Open ($filePath) $worksheet=$oExcel.ActiveWorkbook.Worksheets("AllProcesses")    For $g=0 to UBound($aWriteVal)-1     $worksheet.Range("A"&$g+2).Value=$aWriteVal[$g][0]     If UBound($aWriteVal,2) >0 then $worksheet.Range("B"&$g+2).Value=$aWriteVal[$g][1]     If UBound($aWriteVal,2) >1 then $worksheet.Range("C"&$g+2).Value=$aWriteVal[$g][2]     If UBound($aWriteVal,2) >2 then $worksheet.Range("D"&$g+2).Value=$aWriteVal[$g][3]     If UBound($aWriteVal,2) >3 then $worksheet.Range("E"&$g+2).Value=$aWriteVal[$g][4]     If UBound($aWriteVal,2) >4 then $worksheet.Range("F"&$g+2).Value=$aWriteVal[$g][5]     If UBound($aWriteVal,2) >5 then $worksheet.Range("G"&$g+2).Value=$aWriteVal[$g][6]     Next

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>