Hi All
I'm trying to import sales invoices from excel buffer to a staging table and set the line number similar to sales line table. However my code doesn't work and couldn't figure out the for loop and assigning a line number (line number should increase with each record from Excel buffer to staging table)
Here's the code
for row := 1 to LastRow do begin
NextLineNo := 1000;//
//Clear(Data);
Staging.Init();
Staging.U_No := ImportHeader.U_No;
Staging.U_DocumentType := Staging.U_DocumentType::Invoice;
nextLineNo := nextLineNo + 10000;//
Staging.U_LineNo := nextLineNo;//
Staging.U_DocKey := Buffer.GetText(Buffer, 'P', row);
Staging.U_BillToCustomerNo := Buffer.GetText(Buffer, 'J', row);
Staging.U_Type := Staging.U_Type::Item;
Staging.U_ItemNo := Buffer.GetText(Buffer, 'K', row);
Staging.Insert(true);
end;