I am trying to use the "FIND" command to retrieve multiple comment lines, but I can only seem to get the first record:
CLEAR(Comment_Line);
Comment_Line.SETFILTER("No.", "Service Shipment Header"."Order No.");
Comment_Line.SETRANGE(Type,2);
IF Comment_Line.FIND('-') THEN BEGIN
Fault_1 := Comment_Line.Comment;
REPEAT
UNTIL Comment_Line.NEXT = 0;
END;
Is this the wrong use of the command, or am I misssing something?
As always, thank you for at least reading this.
Krakmup
0
Answers
Try FINDSET instead to guarantee based on your version of NAV that it's working. But i'd guess your filters are bad.
Try settings the filters directly on the NAV table as well if you are confused.
Comment_Line.SETFILTER("No.", "Service Shipment Header"."Order No.");
Comment_Line.SETRANGE(Type,Comment_Line.Type::"2");
IF Comment_Line.FIND('-') THEN BEGIN
REPEAT
IF Fault_1 = '' THEN
Fault_1 := Comment_Line.Comment
ELSE
Fault_1 += Fault_1 + ' ' + Comment_Line.Comment;
UNTIL Comment_Line.NEXT = 0;
END;
I think (of course we are all just guessing) that what is needed is: