web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Index out of bounds

(0) ShareShare
ReportReport
Posted on by

I've got users running report ID 50024 Confirmation Letter from a button it allows them to select print but then quickly throws an 'index out of bounds' error.

I'm debugging the report to find which specific index is out of bounds by stepping through the process using the NAV debugger. 

Wanted to see what insight you pros have

Thanks, 

*This post is locked for comments

I have the same question (0)
  • Suresh Kulla Profile Picture
    50,243 Super User 2025 Season 2 on at

    Rob,

    You will get that error because of Array Varaibles and if the dimension on that variable does match with dimension you are assigning. Ex: if you create a array to store 10 values but trying to assign 11th.

    Debugger should point you that variable and you just need to change the dimension or checkthe logic why for this user it is out of index.

  • Suggested answer
    Alexander Ermakov Profile Picture
    28,096 on at

    You have a customized report. As Suresh mentioned, it is because the data is greater than the array dimension. Take your variable, go to property and increase the dimension size.

  • Suggested answer
    Binesh Profile Picture
    7,885 on at

    Hello,

    As per other members suggested go through, And also check your logic you might be used some bad/extra looping. its also caused to go one more time.

  • Suggested answer
    Amol Salvi Profile Picture
    18,698 on at

    As suggested by Suresh you need to check any Array is used in program. Activate debugger and check.

  • Community Member Profile Picture
    on at

    The debugger breaks at an OnAfterGetRecord() trigger with this code, the pointer at the second line.

    VAR_Index += 1;
    VAR_RSEArray[VAR_Index] := "Work Order No." + '-' + FORMAT(Date) + '-'+ FORMAT(screening_start) +'-'+ FORMAT(screening_stop);

    Thinking VAR_RSEArray was perhaps too small. I checked its properties and found its dimensions to be 300. I bumped it up and tested the report again. No dice. The error still occurs with the the dimensions of that array bumped all the way to 1000.

    Now I suppose report logic is the culprit?

    I'm trying to figure out where in the report is repeating over 1k times using break points in the debugger.

    Any advice on taking this to the next steps?

  • Community Member Profile Picture
    on at


    doing some sleuthing with the debugger and some MESSAGE statements. I've narrowed the issue down to the code in the two triggers down below. What ends up happening is MESSAGE('1'); fires followed by MESSAGE('2'); over and over and over and over until an error pops. 

    I even upped the array dimensions to 50000 took ages but the same error triggered so it's got to be some code problem sending it on a forever loop?


     

    Resource Schedule Entry - OnAfterGetRecord()
    // Skip duplicate records
    MESSAGE('1'); // added by Rob 


    IF (EM_Duplicate("Work Order No." + '-' + FORMAT(Date) + '-'+ FORMAT(screening_start) +'-'+ FORMAT(screening_stop))) THEN
    CurrReport.SKIP;


    MESSAGE('2'); // added by Rob


    VAR_Index += 1;
    VAR_RSEArray[VAR_Index] := "Work Order No." + '-' + FORMAT(Date) + '-'+ FORMAT(screening_start) +'-'+ FORMAT(screening_stop);

    Resource Schedule Entry - OnPostDataItem()

    EM_Duplicate(CONST_RSE : Text[60]) LOCAL_Duplicate : Boolean
    // Checks if duplicate shift exists, skip if found
    LOCAL_Counter := 1;
    LOCAL_Duplicate := FALSE;

    REPEAT
    IF CONST_RSE = VAR_RSEArray[LOCAL_Counter] THEN
    LOCAL_Duplicate := TRUE
    ELSE
    LOCAL_Counter := LOCAL_Counter + 1;

    UNTIL (LOCAL_Counter > VAR_Index) OR (LOCAL_Duplicate= TRUE);

  • Verified answer
    Bodhi Profile Picture
    558 on at

    Before Preview the report, may add filters, like work order No or date, to narrow the records range

    Or the DataItemLink of the Properties for DataItem Resource Schedule Entry should be maintained

  • Community Member Profile Picture
    on at

    DataItem link property for Resource Schedule Entry is <undefined>

    Which Report trigger should I put filters on?

  • Community Member Profile Picture
    on at

    Posted a summary of this question over on mibuso: forum.mibuso.com/.../index-out-of-bounds-report-failing

  • Community Member Profile Picture
    on at

    Thanks Bodhi!!

    the DataItemLink needed to be completed!!!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans