Jump to content

array situation help

Recommended Posts

Basically, my problem is I'm reading a web page table into an array, the table has 5 columns and a varying amount of rows. It is in alphabetical order in sequence of the rows instead of the columns. Ex:

A - B - C - D - E
F - G - H - I - J
K - L - M - N - O
P - Q

I want to condense the 5 columns into 1 column and keep it in alphabetical order. (and also have second column that is blank)

I have an array that looks like the following:

$oIE = _IECreate ("http://www.fuelmeup.com/cities.php?state=NY&statename=NEW%20YORK")
$oForm = _IETableGetCollection( $oIE ,5 )
$aTableData = _IETableWriteToArray ($oForm, True)
$X = UBound($aTableData)*UBound($aTableData, 2)
Dim $aTableData2[$X][1]

For $i = 1 to UBound($aTableData2)
    $aTableData2[$i][0] = $aTableData[$i][0]
    $aTableData2[$i+1][0] = $aTableData[$i][1]
    $aTableData2[$i+2][0] = $aTableData[$i][2]
    $aTableData2[$i+3][0] = $aTableData[$i][3]
    $aTableData2[$i+4][0] = $aTableData[$i][4]  
    $i += 4

The problem is "aTableData2" has 1000 rows, and each "aTableData" has 200 rows...you can pretty much see what I'm trying to do. However, I'm getting array dimension exceeded of course because "aTableData2" has less rows than "aTableData2"...but seemingly, this is how I need to do it. So can someone show me the correct way please.


Link to comment
Share on other sites

I came up with this for the loop which works, but if there is a better and faster way please let me know.

For $i = 1 to UBound($aTableData) - 1
_ArrayInsert2Dst($aTableData2, $aTableData[$i][0])
_ArrayInsert2Dst($aTableData2, $aTableData[$i][1])
_ArrayInsert2Dst($aTableData2, $aTableData[$i][2])
_ArrayInsert2Dst($aTableData2, $aTableData[$i][3])
_ArrayInsert2Dst($aTableData2, $aTableData[$i][4])

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...