Jump to content

Nested Array Problem in Beta


swicks
 Share

Recommended Posts

The code inside the "For i$..." runs fine without the outer loop. As soon as I place the "For i$..." code in place, SciTE throws the error "Array variable has incorrect number of subscripts or subscript dimension range exceeded.:" The only difference is the For...Next? Can someone help me with this?

$startCol = 0
$startRow = 0
$c=0
$r=0
$i = 0
For $i = 1 to 10
    If $aArray[1][$startCol+5] <> " " Then
        For $d = 1 to 10                
            If $aArray[$startRow + 2][$startCol+5] = "Yes" Then
                $bArray[$r][$c] =  $aArray[1][$startCol+5]
                $bArray[$r][$c+1] = $aArray[$startRow + 2][4] ;get the Drive Letter
                $bArray[$r][$c+2] = $aArray[$startRow + 2][2] ;then get the Share Name
                $r=$r+1
                $c=0
            EndIf
            $StartRow=$StartRow+1
        Next
    EndIf
    $startCol=$startCol+1   
Next
Edited by swicks
Link to comment
Share on other sites

Both arrays are dim'd as [12][15] arrays and the snippet works fine without the outer loop!

In your code $r will reach 100 thus exceeding maximum 11 for your arrays first dimention

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Link to comment
Share on other sites

Good catch Bowmore, would have crossed this bridge later on $r.

But the snippet that erroring was:

"If $aArray[$startRow + 2][$startCol+5] = "Yes""

Found the error in not resetting the $startRow to 0 after the inner loop.

Thanks very much for getting me started in the right direction!

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
 Share

  • Recently Browsing   0 members

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