Hi, i have following .csv file:
"G.1001";"Basis BYK 085 (info mrt.2004)";"A"
"G.1002";"Basis ARQUAD 2 HT 75%";"A"
"G.1003";"Basis DUOMEEN TDO";"A"
"G.1004";"Basis TINSTAB BL 277 (dbtl)";"A"
"G.1005";"Basis DISPEX G A -40";"A"
"G.1006";"Basis TEGO FOAMEX 830";"A"
"G.1007";"Basis ACRONAL L 700 50% etac";"A"
"G.1008";"Basis COLLACRAL P (indikmiddel)";"A"
"G.1009";"Basis COLLACRAL VAL";"A"
"G.1010";"Basis BYK 381";"A"
"G.1011";"Basis LATEKOLL D.ca.25%";"A"
"G.1012";"Basis EXKIN 2 - METHYL ETHYL CETOXIME";"A"
Then i have a dataport to process this csv file, but when i run it to insert the csv file, only the last record inside the csv gets inserted?
What could be the cause why not all records get inserted?
I'm inserting this csv in the following table:
Enabled Field No. Field Name Data Type Length Description
Yes 1 ID Integer
Yes 2 Grondstof Text 50
Yes 3 Omschrijving Text 150
Yes 4 ChemischeGroep Text 1
Yes 5 CAS Text 50
Yes 6 EEG Text 50
Yes 7 EG Text 50
Yes 8 RZin Text 50
Yes 9 SZin Text 50
Yes 10 PZin Text 50
Yes 11 Gevaarsymbool Text 50
Yes 12 Divers Text 250
Where the ID field is an autoincrement
0
Answers
NB! ; shall not be in brackets.
FieldEndDelimiter: <">
FieldStartDelimiter: <">
RecordSeparator: <<NewLine>>
DataItemSeparator: <<NewLine><NewLine>>
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
The dataport contains no code.
This are my dataport fields:
Enabled SourceExpr StartPos Width
Yes Grondstof 0 0
Yes Omschrijving 0 0
Yes ChemischeGroep 0 0
But i guess it has something to do with the ID field inside my table...
Does this dataport insert each record on at a time? so that i keep getting a new ID?
Cause i think it's just updating allways the first record that got inserted with the nextrecord in the csv
If i put the autoupdate to No that i get error about ID number already exists in database
ChemischeGrondstof - OnBeforeImportRecord()
ChemischeGrondstof.ID := 0;
Guess the autoincrement doesnt work without this in the dataport
But all records are inserted \:D/
Yes, if you are using autoincrement, you need to insert the record with 0 in PK each time, else you have permission error (on SQL under non_admin account) or this kind of problem on Native. Do not clear only the PK, clear other fields too to prevent other problems (use the INIT after the assigning the 0...)
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.