Report gets infinite loop when it executes a Doc no.

efficeon007
Member Posts: 31
Hi I have a report gets infinite loop when it executes a document no.. I have checked several tables which contain this document no., but I did not find anything strange. Do you think what would be the root cause for this? I can not paste the *.fob file here, if somebody interested in this, I can send the *.fob file to her/his mailbox. Thanks.
Thanks.
Thanks.
I am a expert of questions, not the solution provider, but questions submitter.
0
Answers
-
The output doesn't help us at all...have you got an integer dataitem in your report?If so, investigate about it: a lot of "endless loops problems" are due to bad integer dataitem designer.
Another possible reason is that you have done some find('-') or similar in some onaftergetrecord trigger (or onpresection of body): this changes the pointer and screws up the report because you read the first, print it, re-read the first, re-print it...0 -
Belias wrote:The output doesn't help us at all...have you got an integer dataitem in your report?If so, investigate about it: a lot of "endless loops problems" are due to bad integer dataitem designer.
Another possible reason is that you have done some find('-') or similar in some onaftergetrecord trigger (or onpresection of body): this changes the pointer and screws up the report because you read the first, print it, re-read the first, re-print it...
Sorry. I just checked the report and I found there is "REPEAT" syntax, and only one "REPEAT" in this report:
SETRANGE("Autodocumento generado",TRUE);
IF FIND('-') THEN;
IF i = 1 THEN BEGIN
REPEAT
MovIVATemporal.INIT;
MovIVATemporal.COPY(MovIVA6);
MovIVATemporal.INSERT;
MovIVATemporal.NEXT;
UNTIL MovIVA6.NEXT = 0;
IF FIND('-') THEN;
i := 0;
END;
So I doubt this is the control you mean. But if let the report jump (let it <> document no. 09BB94), the report runs very well.
To fix this problem, I have tried to modify the code as below, but the result still shows infinite 09BB94 records. Could you do me a favor to improve the below code? Thanks.
IF i = 1 THEN BEGIN
MovIVATemporal.SETRANGE("Nº documento",MovIVA6."Nº documento");
MovIVATemporal.SETRANGE("Nº documento",'09BB94');
IF MovIVATemporal.FIND('-')
THEN
BEGIN
IF FIND('-') THEN;
i := 0;
END
ELSE
BEGIN
REPEAT
MovIVATemporal.INIT;
MovIVATemporal.COPY(MovIVA6);
MovIVATemporal.INSERT;
MovIVATemporal.NEXT;
UNTIL MovIVA6.NEXT = 0;
IF FIND('-') THEN;
i := 0;
END;
END; :-kI am a expert of questions, not the solution provider, but questions submitter.0 -
Belias wrote:in what trigger did you put this code?
did you already try to debug it in order to see where the infinite loop is?
OnPreDataItem()
Sorry, i am using 2.60 version and I don't find a place to manually put breakpoint in code.
But I guess the REPEAT...UNTIL caused this problem.I am a expert of questions, not the solution provider, but questions submitter.0 -
Belias wrote:you do this
UNTIL MovIVA6.NEXT = 0;
but i can't find thisMovIVA6.FIND('-');
Yes. But it has:
IF FIND('-') THEN;
The code I show you above exists in MovIVA6 data item, so no need quote table name?I am a expert of questions, not the solution provider, but questions submitter.0 -
First of all, it's useless to PM me, i receive e-mail notifications
I am working too, and sorry, but i prefer to solve my own problems before...anyway...
i didn't know what was the dataitem, but it should be ok to not quote it.
Maybe it's better if you post the whole report (export the txt file): there can be a lot of reasons for your problem if we haven't found it up to now. A common practice is not to loop the dataitem variable inside himself (e.g.: repeat...until the moviva6 "variable" inside moviva6 dataitem)
Last thing(this is not related to the endless problem): I can't understand why do you do thisMovIVATemporal.NEXT;
after thisMovIVATemporal.INSERT;
0 -
Go table Mov. IVA (Table ID=254), find Document No. = 09BB94, select this field, press Ctrl + F8, zoom in it, copy the data into excel; Then find other document no. which can be shown in report normally, copy their data into excel as well. Make comparison, I found invoice 09BB94 has two clients No. in it, whereas other inovices have one client only. I think this is the reason the report went to infinite loop, since I have tried in "trail database": there are two lines for this invoice, then make two lines have the same customer no., finally the report goes normal.
I have to say the report itself has no problem, does it make sense if one sales invoice has two customers' No. into it? Therefore I am wondering if user can adjust / replace the two clients as one, then this problem can be solved. In future, if we have two customers, I think it is better issue two separate invoices.
Anyway, thanks for help!!!I am a expert of questions, not the solution provider, but questions submitter.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions