FindSet The record in table already exists in Business central

AordonezAordonez Member Posts: 8

I am inserting on buffer some data the buffer is "Document Line" and en other part of the code i want o iterate on the records of that buffer (4 lines in example) with the following code

TempDocumentLine.SETRANGE("Document No.","No.");
TempDocumentLine.SETFILTER(Type,'<>%1',TempDocumentLine.Type::" ");
IF TempDocumentLine.FINDSET THEN
TotalTaxes := TotalTaxes + (TempDocumentLine."Amount Including VAT" - TempDocumentLine.Amount);
TotalDiscount := TotalDiscount + TempDocumentLine."Line Discount Amount";
UNTIL TempDocumentLine.NEXT = 0;

But when reach the FindSet line i got the error "The record in table Document Line already exists. Identification fields and values: Document No.='103010',Line No.='10000'"

How can achieve this

Best Answer


  • AordonezAordonez Member Posts: 8
    Thanks for the reply i was missing the reset for the buffer
Sign In or Register to comment.