IF NOT gvImportCounter = 1 THEN BEGIN gvsalesno := gvImportField1; IF gvsalesheader.GET(gvImportField2) THEN BEGIN gvsalesheader.INIT; gvsalesheader."Document Type" :=gvsalesheader."Document Type"::Order; gvsalesheader."No." := COPYSTR(gvImportField2, 1, 20); gvsalesheader.VALIDATE("Sell-to Customer No.", COPYSTR(gvImportField3, 1, 30)); gvsalesheader.INSERT; END; gvImportCounter += 1; END ELSE IF gvImportCounter = 2 THEN BEGIN gvsalesline.RESET; //gvItem.SETRANGE(gvItem."Sales Type"::Customer); //gvItem.SETRANGE(gvItem."Sales Code", gvImportCustNo); gvsalesline.SETRANGE(gvsalesline."No.", gvImportField1); IF NOT gvsalesline.FIND('-') THEN BEGIN //Insert item Price gvsalesline.INIT; gvsalesline."No." := COPYSTR(gvImportField1, 1, 20); //gvsalesline.Quantity := gvImportField2; //gvsalesline."Unit Price" :=gvImportField3; gvsalesline.INSERT; END; gvImportCounter := 1; END;
Comments
read the help for GET. GET requires (but not strictly) parms for Primary key fields. If you are using GET without parms, or less then fields in PK, it actaully tries to get the record with empty primary key fields.
In your case table is T36 with PK: "Document type" (option) and "No." (code20) so you must call GET with both parms, not just second one.
call it like
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
u did not assign the document type for the salesline.and see that the structure of the text file matches the structure of the dataport fields.
you can use format function to modify the decimal into text. Also the code length should be the max length of the decimal value.
let us knwo whether u managed to sort the problem or not