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
Comments
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!
If it was hard to write, it should be hard to understand."
misha
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.
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
If it was hard to write, it should be hard to understand."
misha
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 :
I've tested it, and it works
If it was hard to write, it should be hard to understand."
I've tested and this is what I need.
misha