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
Thanks Bodhi!!
the DataItemLink needed to be completed!!!
Posted a summary of this question over on mibuso: forum.mibuso.com/.../index-out-of-bounds-report-failing
DataItem link property for Resource Schedule Entry is <undefined>
Which Report trigger should I put filters on?
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
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);
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?
As suggested by Suresh you need to check any Array is used in program. Activate debugger and check.
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.
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.
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.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156