Indexing out of range

nvermanverma Member Posts: 396
There is a report that is throwing this error message.

The indexing 0 in the array is outside of the permitted range. The name of the report is Reason for Termination. It just started happening recently. I tried debugging it and this is the line the system is throwing this error message on.
gdecPrecentRate[i] := (gintCountRec[i] / gintNumOfRecrods ) * 100;

gdecPercentRate (Decimal Type) has dimension value set to 100000
gintCountRec (Integer Type) has dimension value set to 100000

I have tried to increase the size of the dimension value. But that didn't work. Its still throwing the same error message.

Comments

  • DenSterDenSter Member Posts: 8,307
    The indexing refers to the value of the variable called 'i'
  • nvermanverma Member Posts: 396
    You were right Den, while debugging I noticed that gdecPercentRate = 0 and the variable "i" = 0.

    To try to fix it, I initialized i :=1;

    IF gintNumOfRecords <> 0 THEN
               i := i + 1; 
                gdecPrecentRate[i] := (gintCountRec[i] / gintNumOfRecrods ) * 100;
    

    now the report is not displaying that error message. But the report is going haywire, its not displaying the output properly.

    I am not sure if incrementing the i is the way to solve it... Why did this message start appearing now, the report was working fine previously.
  • DenSterDenSter Member Posts: 8,307
    nverma wrote:
    Why did this message start appearing now, the report was working fine previously.
    What always helps in a situation like that is to retrace your steps. Think about where you started, when the report still worked. Think about what it is that you changed. Go back and undo that change and try to come up with an explanation of why you are not getting the desired results. Think of what you want to accomplish, what didn't work, and come up with something else.
Sign In or Register to comment.