Almost every time I use SETCURRENTKEY lately in code under v4.0 SP2 I get bizarre and unpredictable results....some data is usually missed out ie. I get less records than expected. Simply comment out the SETCURRENTKEY line and things work as they should :?
I've had this problem now in Dataports, Reports, Tables and Forms! :evil:
I have tried using FIND('-') and FINDFIRST before my REPEAT UNTIL and they both produce this problem
I need to use SETCURRENTKEY otherwise performance is bad.
Please help!?!!
0
Comments
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
REPEAT
IF "On Hold" THEN BEGIN
MaintCallHeader."Pre On Hold Status" := MaintCallHeader.Status;
MaintCallHeader.Status := MaintCallHeader.Status::"On Hold";
SetOnHoldMaintCallLine(TRUE,'Customer placed on Hold');
END ELSE BEGIN
MaintCallHeader.Status := MaintCallHeader."Pre On Hold Status";
CLEAR(MaintCallHeader."Pre On Hold Status");
SetOnHoldMaintCallLine(TRUE,'Customer taken off Hold');
END;
MaintCallHeader.MODIFY;
i += 1;
UNTIL MaintCallHeader.NEXT = 0;
sorry...what's the key?
basically you have to create a maintcallheader2 variable (same as maintcallheader) and then write:
When you order some table, if you change the value of some fields you use to order the table, the order will screw up, so you have to use MODIFY on another instance of the table while you loop into the "original" one...
Hope it's clear...
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
You should also avoid FIND('-') and (even more) FINDFIRST for looping.
The FINDFIRST is if you need ONLY 1 record, and not more.
So, you code would be something like this:
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
#-o ...it is faster, i suppose... 8)
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
I was only asking myself why I didn't use it before... #-o
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
In general it is easier to remember something if you know why it is like that.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog