Jump to content

array error


Valuater
 Share

Recommended Posts

been at this all morning....

just need a little help

For $b = 1 to 1000
            If @error Then ExitLoop
            
            $bRead = FileReadLine($file2, $b)
            $bSplit = StringSplit($bRead, ",")
            
            $TbRecords [0][0] = $bSplit[0]
            $TbRecords [$b][1] = $bSplit[1]
            $TbRecords [$b][2] = $bSplit[2]
            $TbRecords [$b][3] = $bSplit[3]
            $TbRecords [$b][4] = $bSplit[4]
            $TbRecords [$b][5] = $bSplit[5]
            
            
            _ArraySwap($TbRecords[$b][1], $TbRecords[$b][2])
            _ArraySort( $TbRecords,0,1,0,2)
            
            FileWriteLine($file3, $TbRecords [$b][1] & "," & $TbRecords [$b][2] & "," & $TbRecords [$b][3] & "," & $TbRecords [$b][4] & "," & $TbRecords [$b][5])
            
            
            
        Next

the file open and every thing is ok... there are 5 dimensions to the split

but i get this error

i cant find where the error is

8)

the first thing i'd suggest is to reformat your loop to a while instead of a For loop, because you're limiting the number of lines. I know that isn't what you were asking for, but just a tip. could you include some sample data that is being brought in? also is this error happening as soon as the script is run, or after some iterations? it's possible you have a blank line in the file, or a header line etc that isn't formatted the same, so you wouldnt' get the same number of elements from that line.
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...