Because of some circumstances I have to use marking as ONLY solution for my filtering so it comes down to this:
...
SL.MARKEDONLY;
SL.FIND('-');
REPEAT
Flag := TRUE;
SL1.FIND('-');
REPEAT
IF SL1."Document No." <> SL."Document No." THEN
SL1.MARK(FALSE)
ELSE
SL1.MARK(TRUE);
IF SL1.MARK THEN
Flag := FALSE;
IF SL1.NEXT = 0 THEN
Flag := FALSE;
UNTIL Flag;
UNTIL SL.NEXT = 0;
SL1.MARKEDONLY;
...
SL and SL1 are record variables of the same subtype.
SL has SETSELECTIONFILTER set on it.
SL1 is a group of marked sales lines and I must select all the lines where "Document No." are the same!
This "selecting" is actually unmarking the marked lines which do not meet required conditions.
Speed would be acceptable IF IT WOULD WORK THIS WAY.
When I run this piece of code Navision freezes :oops:
What did I do wrong (beside poor solution design :oops: )
Better to be critical then self-critical
Answers
Better try something like this (didn't test it though)
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
You are filtering for MarkedOnly.
You change mark on some record to false.
Where will go the NEXT command? You changed "field" which is used for filtering in the loop... it is common problem...
The next will be lost in the loop if you do that.
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
I was soooo occupied with that nested loop #-o
Thanks, both of you!
RIS Plus, LLC
I added one Boolean flowfield to the table which checks all my conditions and now I'm filtering by that field. I don't know how I didn't figured that out before :?:
Thanks for your help, guys