Page 1 of 1

Error in Array Index

Posted: Fri Feb 26, 2016 9:18 am
by omni
Roger,

All our a/r clear open invoice program uses arrays.

Occasionally users get this error.

oError:description : Error in array index
oError:filename :
oError:genCode : 4
oError:operation : <A of 57>[<58>]

The only thing different is the number, which is always 1 more, so apparently the array counter is off, but have never been able to repeat it. We tell the user to reindex the file, or reboot, and they eventually get it to work. All users utilize this daily, and this comes up just occasionally. Normally on larger numbers, never on very small batches.

If record is selected, it checks to see if already selected and deletes it (that is their instructions on ones selected in error)
Sample:
ADel(aRecords[1],nFound)
ASize(aRecords[1],Len(aRecords[1])-1)

If selected and new.
AAdd(aRecords[1],Receive->pronumbr)

They then edit the transaction and save or cancel.

if they cancel

ADel(aRecords[9],nFound)
ASize(aRecords[1],Len(aRecords[1])-1)

if they accept nothing else is updated.

Do not think anything is wrong with that and have not ever been able to get the counter of the array to be off.

Any thoughts or suggestions?

Fred
Omni

Re: Error in Array Index

Posted: Fri Feb 26, 2016 10:07 am
by rdonnay
I would need to see more code than you are showing.

It appears that you may be adding or deleting array elements in a for..next loop or a do..while loop.

Re: Error in Array Index

Posted: Fri Feb 26, 2016 11:09 am
by omni
Ok, here is that function which is the only function that updates that array.

Uploaded the file but do not see it(?) Tried 4 times, said it uploaded. Arecords.prg was file name.

Re: Error in Array Index

Posted: Fri Feb 26, 2016 12:07 pm
by rdonnay
You can't upload a file with a PRG extension. It's a security risk. Put it in a ZIP or rename the extension.