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 (") ?
0
Comments
Hope this would solve your problem
Cheers
Vijay
How are the fields separated? With a ;? So the FieldSeparator is ;.
The file
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?
Regards
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.
Cheers
Vijay
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.