Dataports : how to import all the file even...

philippegirod
Member Posts: 191
if there are a lot of errors in the data.
2 steps :
1/ Create a table to store all the mistakes :
For instance 50000 "Import file errors"
2/ In the dataport, in each fields wich can contain an error do the next :
For instance, if i want to import in the "Sales Header" the "Sell-to customer Name" :
Like that, you will skip the current field, allow the import of the correct data, and store the error in the error table.
2 steps :
1/ Create a table to store all the mistakes :
For instance 50000 "Import file errors"
2/ In the dataport, in each fields wich can contain an error do the next :
For instance, if i want to import in the "Sales Header" the "Sell-to customer Name" :
OnBeforeEvaluateField IF NOT EVALUATE("Sell-to Customer Name",Text) THEN BEGIN Errors.FIND('+'); NumError := Errors."Line No."; Errors.INIT; //Begin to insert in the "error" table, Errors is a record var Errors."Line No." := NumError + 10000; Errors.Description := STRSUBSTNO('Import error on field %1, [Field Name]',FIELDNAME("Sell-to customer Name"); //Text wich explain what kind of error Errors."Data Type" := 'Text'; //Field type Errors."Incorrect element" := Text; //The text which couldn't be imported Errors.Date := TODAY; //When the error occured Errors.Time := TIME; //When the error occured //Just to know what was the field length : Errors."Field Lenght" := 30; //If i have al lot of tables to import, to know in wich import the error was : Errors."Table Name" := "Sales Header".TABLENAME; //Same idea : in which record the error was : Errors."Record No." := "No."; Errors.INSERT; //To continue the import and not have a navision error message : CurrDataport.SKIP; END;
Like that, you will skip the current field, allow the import of the correct data, and store the error in the error table.
My candle burns by both ends, it will not last the night,
But oh my foes and oh my friends, it gives a lovely light
But oh my foes and oh my friends, it gives a lovely light
0
Comments
-
que?"Real programmers don't comment their code.
If it was hard to write, it should be hard to understand."0
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