I have a problem with dataport import.....

voodoo
Member Posts: 82
I want to import some records(from txt file - 2 "columns" separated by TAB Name, Address) into Customers table. I was made Dataport(with 2 fields(Name, Address), but without No. because I need automaticly generetaed ID from Customer table(General Ledger->Setup->No. series->Customer)) and nothing happened 
Why???
misha

Why???
misha
misha fka voodoo
0
Comments
-
1.) You will need to to INIT the customer record after every imported record.
2.) You will need to insert the record manually using an INSERT(TRUE)
3.) After importing the record and filling the fields you will need to do a modify.
Good luck!"Real programmers don't comment their code.
If it was hard to write, it should be hard to understand."0 -
Thnx, but I'm a rookie in Navision :oops: , so please can you describe steps above little deeper?
mishamisha fka voodoo0 -
Sure,
If you simply insert a customer record with an empty No. you will create a customer recod with no number.
This is becaurse in the OnInsert trigger of the customer table is coded that the record should have an unique number. You can call this code by using the insert(true) command.Cust.INIT; Cust."No." := ''; // Must be empty to let Navision gen. a new number Cust.Name := 'Emiel Romein'; Cust.INSERT(TRUE); // Make sure Navision gen. a new number
You need to do something like this... Another option is:
[code]
Cust.INIT;
Cust."No." := ''; // Must be empty to let Navision gen. a new number
Cust.INSERT(TRUE); // Make sure Navision gen. a new number
Cust.Name := 'Emiel Romein';
Cust.MODIFY;
[\code]
So, start you import by emptying the No. field every time you read a recopnd from the file. Then INSERT(TRUE) the record. Import the fields and modify the record.
Offcouse you understand that I didn't test this all. So I could be way off"Real programmers don't comment their code.
If it was hard to write, it should be hard to understand."0 -
I put your code into Dataport OnAfterImportRecord() trigger and that's work fine, but instead of your name, i need data from txt file. Sorry, I'm C# programmer and I this is my first day with Navision, so that is the reason because my questions are so low level
mishamisha fka voodoo0 -
Ok... Well...
It's a bit more easy then I told you before.
I did a little test and the following works.
Just define your dataport like you dide before. Set the fields in the dataport field designer like you do in a "normal" dataport.
Then code the following in the OnBeforeImportRecord trigger :"No." := ''; INSERT(TRUE);
I've tested it, and it works"Real programmers don't comment their code.
If it was hard to write, it should be hard to understand."0 -
Thnx,
I've tested and this is what I need.
mishamisha fka voodoo0
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