Hi there!
I have two 2D-Arrays.
If the first two columns of the second one fit the data the first two colums in the first array, I want to add the data of the second one into that row.
After joining it is supposed to look like this:
I already have some ideas (using Loops and so on, but maybe there is an UDF that I'm missing).
The array dimenions will be around aFirst[500][8] and for aSecond[750][20].
Note that it won't be that $aFirst[$i][0] won't equal $aSecond[$i][0] in the script.
Thank for suggestions :-)
EDIT:
That is doing the job, but maybe there is a faster way?
I have two 2D-Arrays.
If the first two columns of the second one fit the data the first two colums in the first array, I want to add the data of the second one into that row.
[ autoit ]
$aFirst[0][0] = "Row 1 | Column 1" $aFirst[0][1] = "Row 1 | Column 2" ... $aFirst[9][0] = "Row 10 | Column 1" $aFirst[9][1] = "Row 10 | Column 2" $aSecond[0][0] = "Row 1 | Column 1" $aSecond[0][1] = "Row 1 | Column 2" $aSecond[0][2] = "data 1a" $aSecond[0][3] = "data 1b" ... $aSecond[9][0] = "Row 10 | Column 1" $aSecond[9][1] = "Row 10 | Column 2" $aSecond[9][3] = "data 10a" $aSecond[9][3] = "data 10b"
After joining it is supposed to look like this:
[ autoit ]
$aNew[0][0] = "Row 1 | Column 1" $aNew[0][1] = "Row 1 | Column 2" $aNew[0][2] = "data 1a" $aNew[0][3] = "data 1b" ... $aNew[9][0] = "Row 10 | Column 1" $aNew[9][1] = "Row 10 | Column 2" $aNew[9][2] = "data 10a" $aNew[9][3] = "data 10b"
I already have some ideas (using Loops and so on, but maybe there is an UDF that I'm missing).
The array dimenions will be around aFirst[500][8] and for aSecond[750][20].
Note that it won't be that $aFirst[$i][0] won't equal $aSecond[$i][0] in the script.
Thank for suggestions :-)
EDIT:
[ autoit ]
#include Dim $aFirst[10][3], $aSecond[54][6] $aFirst[0][0] = "Row 1 | Column 1" $aFirst[0][1] = "Row 1 | Column 2" $aFirst[9][0] = "Row 10 | Column 1" $aFirst[9][1] = "Row 10 | Column 2" $aFirst[9][2] = "wixxer" $aSecond[0][0] = "Row 1 | Column 1" $aSecond[0][1] = "Row 1 | Column 2" $aSecond[0][2] = "data 1a" $aSecond[0][3] = "data 1b" $aSecond[20][0] = "Row 10 | Column 1" $aSecond[20][1] = "Row 10 | Column 2" $aSecond[20][2] = "data 10a" $aSecond[20][3] = "data 10b" $aSecond[20][5] = "data asdasd" $iArrayDimDiffernce = UBound($aSecond, 2) - UBound($aFirst, 2) ReDim $aFirst[UBound($aFirst)][UBound($aSecond, 2)+1] For $i = 0 To UBound($aFirst, 1) - 1 $aFirst_Column_1 = $aFirst[$i][0] $aFirst_Column_2 = $aFirst[$i][0] For $j = 0 To UBound($aSecond, 1) - 1 $aSecond_Column_1 = $aSecond[$j][0] $aSecond_Column_2 = $aSecond[$j][1] If $aFirst_Column_1 <> "" And $aFirst_Column_2 <> "" And $aSecond_Column_1 <> "" And $aSecond_Column_2 <> "" Then If $aFirst_Column_1 = $aSecond_Column_1 And $aFirst_Column_2 And $aSecond_Column_2 Then For $k = 2 To UBound($aSecond, 2) - 1 ConsoleWrite($k & @TAB & UBound($aSecond, 2) - 1 & @CR) $aFirst[$i][$k - 2 + $iArrayDimDiffernce] = $aSecond[$j][$k] Next EndIf EndIf Next Next
That is doing the job, but maybe there is a faster way?