Dataport (Importing Blank Fields)

Pavlos
Member Posts: 19
Hi to all,
I’m relatively new to navision. I’m currently facing a problem when I’m trying to import data from a csv (comma separated values) file into a table in navision. A sample of the data in the cvs file (produced by MS Excel) is as follows:
Field_1A;Field_1B;Field_1C
Field_2A;Field_2B;
Field_3A;Field_3B;
Field_4A;Field_4B;Field_4C
Field_5A;Field_5B;Field_5C
Field_6A;Field_6B;
Field_7A;Field_7B;Field_7C
Notice that at the 3rd column some fields are blank (Rows 2,3 and 6).
I’m using a dataport in order to import it into a navision table. The resulting table after running the dataport is:
Field_1A Field_1B Field_1C
Field_2A Field_2B Field_1C
Field_3A Field_3B Field_1C
Field_4A Field_4B Field_4C
Field_5A Field_5B Field_5C
Field_6A Field_6B Field_5C
Field_7A Field_7B Field_7C
Notice that the blank fields at 3rd column are filled with the value of the previous filled field (Rows 2,3, and 6). Why does this happen? It seems a bit odd to me. I want these fields to be blank as my original data. Can anybody help?
Thanks in advance,
Pavlos Papantoniou
I’m relatively new to navision. I’m currently facing a problem when I’m trying to import data from a csv (comma separated values) file into a table in navision. A sample of the data in the cvs file (produced by MS Excel) is as follows:
Field_1A;Field_1B;Field_1C
Field_2A;Field_2B;
Field_3A;Field_3B;
Field_4A;Field_4B;Field_4C
Field_5A;Field_5B;Field_5C
Field_6A;Field_6B;
Field_7A;Field_7B;Field_7C
Notice that at the 3rd column some fields are blank (Rows 2,3 and 6).
I’m using a dataport in order to import it into a navision table. The resulting table after running the dataport is:
Field_1A Field_1B Field_1C
Field_2A Field_2B Field_1C
Field_3A Field_3B Field_1C
Field_4A Field_4B Field_4C
Field_5A Field_5B Field_5C
Field_6A Field_6B Field_5C
Field_7A Field_7B Field_7C
Notice that the blank fields at 3rd column are filled with the value of the previous filled field (Rows 2,3, and 6). Why does this happen? It seems a bit odd to me. I want these fields to be blank as my original data. Can anybody help?
Thanks in advance,
Pavlos Papantoniou
0
Comments
-
you can not import blank field.
You will have to create a new Global Variable and use it on the place you want to import the last (blank) value. Then fill your field with tha variable.
This shoudl solve your problem."Real programmers don't comment their code.
If it was hard to write, it should be hard to understand."0 -
Even better, structure your csv file as such:
Field_1A;Field_1B;Field_1C;
Field_2A;Field_2B;;
Field_3A;Field_3B;;
Field_4A;Field_4B;Field_4C;
Field_5A;Field_5B;Field_5C;
Field_6A;Field_6B;;
Field_7A;Field_7B;Field_7C;
What is happening behind the scenes is that Navision after it reads the first record is assigning Field_1A, Field_1B & Field_1C to three internal variables. When it reads the second line it does not first clear out these variables, so without the explicit ';' it does not assign a blank value to the third variable. The semicolon at the end tells Navision that it should assign the next variable.
This will also work in the following situation:
Field_2A;;Field_1C;
You in fact can import blank fields, this is actual data in some cases and shouldn't be missed.
Generally speaking with dataports you need the dividor (semicolon or comma) at the end of each line, and all values should be enclosed in double quotes. If you can get that from your client then consider yourself lucky.
-A0 -
Try INIT the record OnBeforeImportRecord.0
-
Thank you all guys...
all work fine... but I found better the first advice by declaring a global variable... etc
Pavlos0
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