Import file with tabs (without dataport)
ngebhard
Posts: 127
Hello everybody,
any ideas if your importing a file with tabs without using a dataport?
We created a function to run several imports using a NAS timer setup. This works fine with field seperators like ";" or "|". Now we need to run the function with tab as field seperation. I tried to convert it to char but this doesn't work because the tab comes as several blanks. Any hints?
Thanks a lot!
Regards
Nicole
any ideas if your importing a file with tabs without using a dataport?
We created a function to run several imports using a NAS timer setup. This works fine with field seperators like ";" or "|". Now we need to run the function with tab as field seperation. I tried to convert it to char but this doesn't work because the tab comes as several blanks. Any hints?
Thanks a lot!
Regards
Nicole
ProTAKT Projekte & Business Software AG
Microsoft Dynamics NAV Partner
Bad Nauheim, Germany
http://www.protakt.de
http://twitter.com/protakt
Microsoft Dynamics NAV Partner
Bad Nauheim, Germany
http://www.protakt.de
http://twitter.com/protakt
0
Answers
-
If you have blanks in input file - means that you have not separated fields with tabs. You can use DELCHR function if it is possible.
If you want to maintain tabs separated file, you have to define char variable (length 1 byte), assign value 9 (TAB code) into it and separate needed field from imput string.0 -
The file has tabs as field seperator. But if I use the File.Read-function the tabulator (shown as hexcode 09) comes up as several blanks (shown as hexcode 20). I tried to use a char-variable but it doesn't match, because the File.Read-function turns them into blanks.
Any ideas?!ProTAKT Projekte & Business Software AG
Microsoft Dynamics NAV Partner
Bad Nauheim, Germany
http://www.protakt.de
http://twitter.com/protakt0 -
Hi
I think only via InStream. For example so:
f.TEXTMODE := TRUE;
f.OPEN('c:\1.txt');
f.CREATEINSTREAM(stream);
WHILE stream.READTEXT(str) > 0 DO BEGIN
MESSAGE(str);
FOR i := 1 TO STRLEN(str) DO
IF str = 9 THEN
str := '^';
MESSAGE(str);
END;
f.CLOSE;0 -
Maybe an ADO Solution if it fails?
http://dynamicsuser.net/forums/post/61970.aspx
http://dynamicsuser.net/forums/post/52315.aspx0 -
I used the instream-method and it worked! Thanks a lot!!!
Regards
NicoleProTAKT Projekte & Business Software AG
Microsoft Dynamics NAV Partner
Bad Nauheim, Germany
http://www.protakt.de
http://twitter.com/protakt0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K 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
- 611 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 253 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions