Format CSV

DesmedtS
Member Posts: 53
hello,
I export navision data to a CSV file.
this works fine, the only problem i have got is formatting data. For example, if i want to export the value 00001 i got in my CSV file 1.
So I thougt, lets make all the sheet set as text.
But no effect.
anybody got a solution ?
Thx
I export navision data to a CSV file.
this works fine, the only problem i have got is formatting data. For example, if i want to export the value 00001 i got in my CSV file 1.
So I thougt, lets make all the sheet set as text.
But no effect.
anybody got a solution ?
Thx
0
Comments
-
1. what value do you have stored in navision ?
2. what is the data type ?
you will have to use FORMAT function and/or some other string functions. please read in help how to use it.
a hint. if you want to format an integer iMyInt with a fixed length (iTargetLength) string (tMystr) with leading zero here's one way to do it:
tMyStr := PADSTR('',iTargetLength - STRLEN(FORMAT(iMyInt)),'0') + FORMAT(iMyInt);®obi
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯0 -
The value stored in Navision is 000001
The datatype is code
I Hope this can help you0 -
If you are using dataport then for sure in csv file should be leading 0. Open your csv file with text editor (notepad) not Excel and check this.®obi
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯0 -
I have checked my CSV, this is correct.
But when he is automaticly opened in Excel, the leading zeroes are gone.
I tried to set my worksheet as text but no result0 -
Excel is so "smart" that is sometimes to smart. It doesn't help that you set cell format to text after opening csv, because the "damage" has already been done.
What you can do is to name your file with .txt extension. and open a file with notepad (etc.). use CTRL+A (Select All) and CTRL+C to copy all and paste it to clear excel sheet. BUT before pasting in Excel select all cells in Excel and set cell format to text.
If the filed delimiter in your dataport is , or ; you will have to split your cell data. But instead of doing this, just change the field delimiter in dataport to <TAB>.
Then when pasting to Excel fileds will be placed into own cells...®obi
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯0 -
There is another good solution in Excel:
The file extention should be ".TXT" (not ".CSV"). When you open the file a window will open where you select the delimeter, etc.
When you press next you can select a format for each column - select text format for your column.
Wish you success!0 -
if you insert an [ ' ] apostrophe (did i spell that right?) before 00001
'00001 - when it goes into excel does it leave 00001 in the field?0 -
Nop, no effect :x0
-
but the 0000 are in the file (as you said), so it's just the matter how this file is opened in excel... and there are some hints to do that.
are we missing something ?®obi
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯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
- 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