error in dataport while importing

vikas
Member Posts: 46
i am importing a text file such that data in first line is stored in sales header and 2nd data in sales line.but the problem is that it gives error in
"if not gvsalesheader.get();" line saying-- the expression code cannot be type converted to a option-value.
and how to convert a code datatype into decimal. because quantity and unit price in sales are in decimal and my three gobal variables are in code.
help me in this regard
"if not gvsalesheader.get();" line saying-- the expression code cannot be type converted to a option-value.
and how to convert a code datatype into decimal. because quantity and unit price in sales are in decimal and my three gobal variables are in code.
help me in this regard
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;
0
Comments
-
Have you tried it with the Evaluate command?0
-
"if not gvsalesheader.get();" line saying-- the expression code cannot be type converted to a option-value.
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 likegvsalesheader.get(gvsalesheader."Document Type"::Order,vImportField2)
®obi
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯0 -
Hi Vikas,
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 notLR0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions