Importing invoice text lines

I have created dataports to import invoice data from another system. The dataports imports the data into the sales header and sales line tables as invoices. This works OK as long as I don’t try to import text only lines into sales line. What value does the row type field need to have if it should be imported as a text line? I have tride with having it empty, a 0 or space but nothing seems to work. When I export to a file, row type is always empty for such records. It’s version 2.60 I’m using.

0 should do the trick. What error message you get? Or what behavior you have while inserting the line?

When using 0 I get something like "Row type should not be in sales line ". I guess it means that it translates the 0 to ‘’ but it isn’t correct anyway. I get the same error message when I leave that field empty in the file.

Hm, do you use any coding or do you directly import into the field “Sales Line”.Type? The following code is working fine: "Sales Line".INIT; "Sales Line"."Document Type" := "Sales Line"."Document Type"::Order; "Sales Line"."Document No." := 'xxxx'; "Sales Line"."Line No." := {increased Line No.} yyyy; "Sales Line"."Sell-to Customer No." := zzzz; "Sales Line".Type := 0; "Sales Line".Description := {your text} ''; ..... "Sales Line".insert; Please publish you code (if you are using code) here; at least that part where you try to assign the “Sales Line”.Type.

I’m not using any code, I do the import directly from the text file. I have set it to use field validation. Perhaps I should try using code instead.

quote:

Perhaps I should try using code instead.
Originally posted by jwi - 2005 Mar 22 : 11:52:27

Read your LineType into a defined VarLineType and assign the “Sales Line”.Type by using eg. case structure. Use the OnAfterImportRecord() trigger. case VarLineType of 0 {or ''} : "Sales Line".Type := 0; ... 'ITEM' {or whaterver you are using here} : "Sales Line".Type := 2; ... end; {case} Good luck.

Thanks for the help, I think I solved it now. I changed so that I import all the fields to variables and then depending on the line type i import some of the values into the fields. I think the problem was that it didn’t like som of the fields in the import, like quantity and price. But those were needed for lines that were not of the text type.