Dataport import problem!!!

JTPro
Member Posts: 169
Hi all!
I want to import data from external file (.csv) to Post Code table. I want to skip all records that fields Code or City are empty, so I write such code in OnAferImportRecord trigger:
It seems ok, but when I run my dataport error occured:
"The field cannot be empty. Please enter a value".
I even try the same code in OnBeforeImportRecord, but nothing changed.
I thought that CurrDataport.SKIP omits current processed record and starts new one?
Any idea?
Best regards!!!
I want to import data from external file (.csv) to Post Code table. I want to skip all records that fields Code or City are empty, so I write such code in OnAferImportRecord trigger:
IF (PC.Code = '') OR (PC.City = '') THEN CurrDataport.SKIP;
It seems ok, but when I run my dataport error occured:
"The field cannot be empty. Please enter a value".
I even try the same code in OnBeforeImportRecord, but nothing changed.
I thought that CurrDataport.SKIP omits current processed record and starts new one?
Any idea?
Best regards!!!
Navision Application Version: 4.0SP1
Navision Database Version: 4.0
Navision Database Version: 4.0
0
Comments
-
Try to turn off AutoUpdate and AutoInsert on the dataitem and save the record through C/AL code (add line with Insert or Modify as needed)0
-
Why not just do a quick excel edit of the data file and delete the blank records, easier then coding and you are sure what will be imported0
-
I also face similiar with the problem, I try to turn off AutoUpdate and AutoSave on the properties and save the record through C/AL code (add line with Insert or Modify as needed).
But I still get the error for "The field cannot be empty. Please enter a value".
Anyone can help? ](*,)0 -
Even if Post Code is empty it cannot be inserted in table as "Not Blank " Property for Code In Post Code Table is True0
-
ya, if I pass some value to post code but still get the error.
eg. if postcode = '' then
"Post Code" := addr4
else
"Post Code" := postcode;0 -
Hi Try using the following code . Tried its working fine for me.
IF (PCode='') OR (PCity='') THEN
CurrDataport.SKIP
ELSE
BEGIN
Postcode.Code:=Pcode;
Postcode.City:=PCity;
Postcode.INSERT;
END
Create the dataport with Pcode and Pcity in field designer.
Hope it works for you0 -
ya, it's work fine.
Thank a lot.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