Import .csv file w/o deleting any of the characters
emina
Member Posts: 4
I am using dataport to import the csv file.
The problem that I am having is that there are too many (") characters in the file & I am not allow to open the file to remove it. :?
I have tried to set FieldStartDelimiter & FieldEndDelimiter to <None> but it is still showing me errors.
I think the decimal value is the cause of it. eg. "11,020.00" &
If I set the FieldStartDelimiter & FieldEndDelimiter to <"> then I will be having problem with the text field.
I have a text that contains lots of (") character eg. "GAUGE;PRESS;0-60PSI;2-1/2"" FACE;1/4"" NPT".
It will be interpreted as GAUGE;PRESS;0-60PSI;2-1/2.
Is there any other ways to import the whole file without clearing the (") ?
The problem that I am having is that there are too many (") characters in the file & I am not allow to open the file to remove it. :?
I have tried to set FieldStartDelimiter & FieldEndDelimiter to <None> but it is still showing me errors.
I think the decimal value is the cause of it. eg. "11,020.00" &
If I set the FieldStartDelimiter & FieldEndDelimiter to <"> then I will be having problem with the text field.
I have a text that contains lots of (") character eg. "GAUGE;PRESS;0-60PSI;2-1/2"" FACE;1/4"" NPT".
It will be interpreted as GAUGE;PRESS;0-60PSI;2-1/2.
Is there any other ways to import the whole file without clearing the (") ?
0
Comments
-
You cannot import file with " it will not allow you, instead remove " and use( ' ) twice i.e ( " ) is typed using shift , instead use use same key twice without using shift. In simple terms instead of using quotes use apostrophe.
Hope this would solve your problem
Cheers
Vijay0 -
if the fields start and end with a " (the sign over the 2) and not with two ' (and this ' 2x) use as FieldStartDelimiter & FieldEndDelimiter the ".
How are the fields separated? With a ;? So the FieldSeparator is ;.
The file"BlaBlabla";"123,45";"454";"dfgr"
The setting in the dataport:
FieldSeparator -> ;
FieldEndDelimiter -> "
FieldStartDelimiter -> "
FileFormat -> Variable
But not: If the decimal is 12345,34 (the ,34 are the decimal places) and your system (local settings) use as separator for decimal values a dot (.) then the imported decimal is wrong. So you must convert it first.
And why do you can't use a copy of the file and change this copy? Why is this not allowed?
RegardsDo you make it right, it works too!0 -
Vijay,
It doesn't really works with csv format. Because upon import, the dataport will interpret as separate fields before I can do anything.
Eg.
Field 1: "GAUGE;PRESS;0-60PSI;2-1/2"
Field 2: " FACE;1/4"
Field 3: " NPT"
Garak,
The file comes as it is. The description -> "GAUGE;PRESS;0-60PSI;2-1/2"" FACE;1/4"" NPT" is a field.
I need to import the whole thing in 1 field.
The FieldSeparator would be (,) & not (;).
As for the decimal value, I have come out with a code to remove the comma.
But the to import the description issue still remains.
& reason why it is not allowed to do changes, o well, it's one of the customer requirement.
0 -
I have done that earlier and the data has got imported.. try it out.. if doesnt probably i am wrong, if ported then ur problem is solved.
Cheers
Vijay0 -
I tried to test this with a file importing to Table 9 (Countries/Regions) with only code and name. (Don't do this at home except in a testcompany - it makes a mess by creating some unwanted codes..)

Testdata:
"WW";"Countryname 1"
"QQ";"Quote "" Name2"
FieldStartDelimiter and FieldendDelimitor: <">
FieldSeparator: ;
and it created a mess, so it did not work with me either.
It is possible to bypass this by manipulating the file runtime in the OnPreDataport trigger (at that time you know the CurrDataport.Filename) - create a copy of it and manipulate the original etc., but I believe NAV should be able to recognize the combination "; as end of field and treat the "" as text.
But then again. Some of the fun of coding in C/SIDE is to overcome the limitations of it.
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
- 322 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