Problem reading tab delimited file (converts tabs to spaces)

andre_n
Member Posts: 12
hi,
i'm writing a codeunit which needs to read a tab delimited file into na3.70, but navision reads the tabs as spaces :evil:. is there a way around this (or rather: what's the way around this)?
thanks.
andre
i'm writing a codeunit which needs to read a tab delimited file into na3.70, but navision reads the tabs as spaces :evil:. is there a way around this (or rather: what's the way around this)?
thanks.
andre
0
Comments
-
Create a variable of the type Char and set it to 9 (i.e. Char9) - as far as I remember tab has ascii code 9.
Then test the import string for the character format(Char9) and you have found the place of the delimiter.0 -
thanks Torben.
navision converts the tabs (ascii 9, you're right) to space(s) (ascii 32), so the comparison will always be false. i can't check for spaces because a tab character converts to either 1, 2 or 3 space characters, and a 1 space character is legal in description fields for example.0 -
Are you using <TAB> as the FieldSeparator?Nelson Alberto0
-
i am not using a dataport Nelson (i assume that's what you are referring to?), but reading the file directly from a codeunit.0
-
I think you must open the file in binary mode, so Navision doesn't convert the chars.
Correct me if I'm wrong :roll:Timo Lässer
Microsoft Dynamics NAV Developer since 1997
MSDynamics.de - German Microsoft Dynamics Community - member of [clip]0 -
This is very easy:
WHILE fileIn.POS < fileIn.LEN DO BEGIN fileIn.READ(chrIn); IF chrIn = 9 THEN...
0 -
i'm glad it's so easy for you :twisted:
thanks!!!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