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.
I am a expert of questions, not the solution provider, but questions submitter.
0
Answers
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...
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
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; :-k
did you already try to debug it in order to see where the infinite loop is?
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
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.
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
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 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 this
after this
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
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!!!