Importing csv file

IoannaK
Member Posts: 14
Hi to all members of the forum. I usually only read your posts but now it's time for me to ask your help.It's my first attempt to run a dataport.
I would like to import in navision a csv file which was in xls form before with type text. I don't use request form. When I run the dataport I get an error message:
'The text 'almost all my fields in csv file' is too long. The text in code fields can have a maximum length of 20 characters'.
I would like to hear from you any advice.
Thank you in advance.
I would like to import in navision a csv file which was in xls form before with type text. I don't use request form. When I run the dataport I get an error message:
'The text 'almost all my fields in csv file' is too long. The text in code fields can have a maximum length of 20 characters'.
I would like to hear from you any advice.
Thank you in advance.
0
Comments
-
The Field length error could be due to the following:
1. The import file is NOT in .CSV format
2. There is a field with "," (Comma) as part of the values
3. The Dataport Field Separator is not the same as in the CSV file.
if you are the one that create dthe Dataport and u used default settings for the Feld and record separators, then ensure that you saved the import file in Excel as "Comma Delimited (.CSV)" file. You also ensure that the Excel File has no "," as part of the field values (Else you will have too change your Field separator to another character in the Navision Dataport).Sunday, Godwin G0 -
It is better to use tabulation=TAB-separated files.
Dataport properties FieldStartDelimiter,FieldEndDelimiter=<None>
FieldSeparator=<TAB>.
I always use them since I got tired of the problems with CSV. With Tab-separated files I never have the problems of a ',' in a field.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
The Openoffice Calc allows you to use TAB instead of ; or , as the field separator when exporting data from the worksheet
http://www.openoffice.org/Kai Kowalewski0 -
Thanks a lot for your quick response!!
@sgg
I have saved the file in csv (MS-DOS) format because otherwise I import non readable characters. Even If I save the file in csv (Comma Delimited) I get the same error message with non readable characters. I am sure that I don't have any comma in my xls file. In the csv file I have all that strange characters.
@kriki
I used Tab as field separator and the other two with value <none> but without a result.
I try to run the dataport before saving it so as to test if everything is ok. Am I doing well? If I run the dataport before saving it I get this error message. If I save and then run I get a snap shot and nothing is imported.
The properties of the dataport are the follow:
ID:50002
Name:C
Caption:C
CaptionML:ENU=C
Import:<Yes>
FileName:C:\Documents and Settings\joank\My Documents\customer.csv
FileFormat:<Variable>
FieldStartDelimiter:<None>
FieldEndDelimiter:<None>
FieldSeparator:<TAB>
RecordSeparator:<<NewLine>>
DataItemSeparator:<<NewLine><NewLine>>
UseReqForm:No
ShowStatus:<Yes>
TransactionType:<UpdateNoLocks>
Permissions:<Undefined>0 -
IoannaK wrote:FileName:C:\Documents and Settings\joank\My Documents\customer.csv
It is also possible you swapped some fields in the dataport.
It is also possible there are some fields too large to fit into Navision-fields.
In this case you have to use textfields that are long enough as the datafields.
In the "OnBeforeImportRecord()"-trigger, you ALWAYS have to clear the fields used in the the datafields.
In the "OnAfterImportRecord()", you can write the imported data to your tables.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
@kriki
Unfortunately when I save the file in txt format, I change the filename extension, I put field separator <TAB>, FieldStartDelimiter <None>, FieldEndDelimiter <None> and I run the dataport nothing happens ](*,)
I think that I am a little bit closer. The csv file contains strange characters inside. Probably and commas even if the xls hasn't.0 -
The strange characters might be the tabs. If these strange characters only appear between fields, then they are, otherwise something is wrong here.
Can you post 2 or 3 lines (maybe you want to put fake data in those lines)? So we can check it out.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
Thank you for your continuous support guys!
1)Once again the properties of the dataport are the follow:
ID:50001
Name:Customer
Caption:Customer
CaptionML:ENU=Customer
Import:<Yes>
FileName:C:\Documents and Settings\joank\My Documents\customer.txt
FileFormat:<Variable>
FieldStartDelimiter:<None>
FieldEndDelimiter:<None>
FieldSeparator:<TAB>
RecordSeparator:<<NewLine>>
DataItemSeparator:<<NewLine><NewLine>>
UseReqForm:<Yes>
ShowStatus:<Yes>
TransactionType:<UpdateNoLocks>
Permissions:<Undefined>
2)I have selected the follow fields :
Enabled SourceExpr StartPos Width
Yes "No." 1 20
Yes Name 22 30
Yes Address 53 30
Yes City 84 30
Yes "Phone No." 115 30
Yes "Gen. Bus. Posting Group" 146 10
3)I compile the dataport before running it.
4)The txt file contains one row ( I save the xls to csv MS-DOS and then the csv to txt)
00001,‰˜¨¨α,isiodou,thiva,2262022594,„‘—’„?ˆ‰Ž“
5)I use Navision 4.00 version on SQL Server.
And the message is the same:
'The text '00001,Καρρά,isiodou,thiva,2262022594,ΕΣΩΤΕΡΙΚΟΥ'
is too long. The text in code fields can have a maximum length of 20 characters'
Dataports may be too difficult for me to handle with, I quess.0 -
4)The txt file contains one row ( I save the xls to csv MS-DOS and then the csv to txt)
00001,‰˜¨¨α,isiodou,thiva,2262022594,„‘—’„?ˆ‰Ž“
Save the file as tab-deilimited (*.txt) directly from Excel.There are no bugs - only undocumented features.0 -
bbrown wrote:4)The txt file contains one row ( I save the xls to csv MS-DOS and then the csv to txt)
00001,‰˜¨¨α,isiodou,thiva,2262022594,„‘—’„?ˆ‰Ž“
Save the file as tab-deilimited (*.txt) directly from Excel.
To save it directly as tab-seperated in Excel : File->Save as-> Save as type-field:text(Tab Delimited)(*.txt). Then it should work.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
And one tip> Sometime the problems is " (doublequote) character in text. In this case excel write it as """" and the Navision parser has problems with that and take it as end of field...0
-
kine wrote:And one tip> Sometime the problems is " (doublequote) character in text. In this case excel write it as """" and the Navision parser has problems with that and take it as end of field...
The only thing to do is to change "" into " in the text.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
Thanks! I run to follow your tips.
I will let you know.0 -
In Navision 2.0 entering <TAB> as the field delimiter can cause problems bacause the dataport handles this as an ASCII text.
Try to open Wordpad, press the TAB buttton, copy the result with ctrl-c and paste it to the field delimiter properties in the Navision 2.x dataport with ctrl-v.
You can also see the difference if you use the dataport to export data to a file.0 -
The <TAB> solution is working but I import strange characters (the language is greek). English words are just perfect.
I am thinking to go abroad ](*,)0 -
If you search the forum for Import Characters
there are several posts about to import these strange characters0 -
Thanx Savatage for your advice. I have searched only for dataports.
By the way I found I way that works fine for me. It is a little bit bizzare I think.
I save xls to csv and then csv to txt. I import with field separator ;
FieldStartDelimiter:<None> and FieldEndDelimiter=<None>
Probably there is a solution for everyone0
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