Dataport export from Purch. Inv. Line with ref. to Purch. Inv. header

Hi all

I am trying to export all Purch. Inv. Lines from a specific date range

Unfortunately the Purch. Inv. Line table doesn’t have the posting date entry as the table Purch. Inv. Header has.

I have tried creating the following in the OnBeforeExportRecord() where pinvh is a C/AL Global variable with datatype record and subtype Purch. Inv. Header

pinvh.GET(“Document No.”);
pinvh.SETFILTER(“Document No.”, ‘KF13870’); ← This was just to see if I could get 1 purchase header out

Unfortunately it doesn’t work :frowning:

YOu can’;t indent a dataitem in dataports. just use the puchaseinv line table from there you can get the other needed fields from the header

Try on AfterExportRecord

have you tried using CurrDataport.Skip if the data doesn’t meet your criteria?

Example
if pinvh.get(“Document No,”) then begin
if pinvh.“Posting Date” <> “your date” then begin
CurrDataport.Skip;
end else begin
expPostingDate := pinvh.“Posting Date”;
expDocNo := “Document NO.”;
expVendNo := “Sell-To Vendor No”;
expItemNo := “Item No”;
end;
end;

Ususally I create al the fields I want to export as variables, enter the variable into the dataport fields & map them

Beautiful, thanks mate :slight_smile: