Hey all, I posted this question up the other day:
https://community.dynamics.com/nav/f/34/p/236581/652583#652583I'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, OnAfterGetRecord (line 107-111) repeats endlessly when I debug and the RTC client shows its receiving thousands and thousand of rows.
I looked at the Dimensions on VAR_RSEArray as suggested on microsoft's site and found them set to 300.
I though dimensions had to be set like 300;2?
I upped the single number to 500, 10,000 even to 50,000 and got the same error it just takes progressively longer.
I'm quite stumped right now on what to do or how to troubleshoot this further.
Can anyone recommend some sites or blogs to teach reporting or C/AL troubleshooting.
I can attach the object as text if that would help to further troubleshoot. This is the logic endlessly repeating and ultimately throwing the index out of bounds error:
IF (EXM_Duplicate("Work Order No." + '-' + FORMAT(Date) + '-'+ FORMAT(screening_start) +'-'+ FORMAT(screening_stop))) THEN
CurrReport.SKIP;
VAR_Index += 1;
VAR_RSEArray[VAR_Index] := "Work Order No." + '-' + FORMAT(Date) + '-'+ FORMAT(screening_start) +'-'+ FORMAT(screening_stop);
Now, below that within the same trigger is a section of code commented out with no documented reason.. always great to clean up somebody else's mess.
//
// IF ((VAR_LastWO <> "Work Order No.") OR (VAR_LastDate <> Date) OR (VAR_LastTime <> screening_start) OR
// (VAR_LastStopScreen <> screening_stop)) THEN
// BEGIN
// CLEAR(VAR_RSEArray);
// CLEAR(VAR_Index);
// IF (VAR_LastWO = '') THEN
// VAR_RSEArray[1] := "Work Order No." + '-' + FORMAT(Date) + '-'+ FORMAT(screening_start) +'-'+ FORMAT(screening_stop);
// VAR_LastWO := "Work Order No.";
// VAR_LastDate := Date;
// VAR_LastTime := screening_start;
// VAR_LastStopScreen := screening_stop;
// END ELSE
// BEGIN
// IF (EM_Duplicate("Work Order No." + '-' + FORMAT(Date) + '-'+ FORMAT(screening_start) +'-'+ FORMAT(screening_stop))) THEN
// CurrReport.SKIP;
// END;
I see there are some CLEAR statements in there.
I tried uncommenting the full block above and the report runs and runs and runs and runs before saying:
"rendering output for the report failed and the following error occurred: An error has occurred during report processing"
Found that that could be related to the OperationTimeout value set on service customsettings.config and that value is set to Max
I'm having
great difficulty in moving this along. I appreciate any assistance.
here's the EM_Duplicate function referenced above:
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);
Answers
I made these changes to the code commenting out the new stuff and uncommenting the old under Resource Schedule Entry - OnAfterGetRecord() trigger.
//IF (EXM_Duplicate("Work Order No." + '-' + FORMAT(Date) + '-'+ FORMAT(screening_start) +'-'+ //FORMAT(screening_stop))) THEN
//CurrReport.SKIP;
//VAR_Index += 1;
//VAR_RSEArray[VAR_Index] := "Work Order No." + '-' + FORMAT(Date) + '-'+ FORMAT(screening_start) +'-'+ FORMAT(screening_stop);
IF ((VAR_LastWO <> "Work Order No.") OR (VAR_LastDate <> Date) OR (VAR_LastTime <> screening_start) OR
(VAR_LastStopScreen <> screening_stop)) THEN
BEGIN
CLEAR(VAR_RSEArray);
CLEAR(VAR_Index);
IF (VAR_LastWO = '') THEN
VAR_RSEArray[1] := "Work Order No." + '-' + FORMAT(Date) + '-'+ FORMAT(screening_start) +'-'+ FORMAT(screening_stop);
VAR_LastWO := "Work Order No.";
VAR_LastDate := Date;
VAR_LastTime := screening_start;
VAR_LastStopScreen := screening_stop;
END ELSE
BEGIN
IF (EM_Duplicate("Work Order No." + '-' + FORMAT(Date) + '-'+ FORMAT(screening_start) +'-'+ FORMAT(screening_stop))) THEN
CurrReport.SKIP;
END;
I don't get hte index out of bounds error now but instead get an error on the report that says:
"An error occurred during local report processing. An error has occurred during report processing. Stream was too long."
User Bodhi sent me towards the DataItemLink.
cheers NAV folks.
2. What is the reason to print more then 10000 lines?
3. Use temptable instead of arrays.