How to read a row longer than 1024 lenth from a csv file?

gison
Member Posts: 128
Dear all,
I'm trying to read a csv file and import into Navision... but the problem is the vairable:g_txtProcessingLine have 1024 length limitation.
The row in the csv file is possible more then 1024 length, does anyone know how to deal with it? I'm trying to study how to use bigtext datatype but... it seem to not working... :?
===================================
g_txtImportFilename := 'D:\Employee.csv';
g_filCatalogImportFile.TEXTMODE(TRUE);
g_filCatalogImportFile.OPEN(g_txtImportFilename);
g_filCatalogImportFile.READ(g_txtProcessingLine);
===================================
I'm trying to read a csv file and import into Navision... but the problem is the vairable:g_txtProcessingLine have 1024 length limitation.
The row in the csv file is possible more then 1024 length, does anyone know how to deal with it? I'm trying to study how to use bigtext datatype but... it seem to not working... :?
===================================
g_txtImportFilename := 'D:\Employee.csv';
g_filCatalogImportFile.TEXTMODE(TRUE);
g_filCatalogImportFile.OPEN(g_txtImportFilename);
g_filCatalogImportFile.READ(g_txtProcessingLine);
===================================
0
Comments
-
If you want to read it through code, you can use binary mode to read the data char by char and join the chars into text and split the text as soon as possible into separate fields. Than you can read long line as you wish (there is just one limit -that one field in the line is not longer than 1024 chars).0
-
Hi Kine,
I'm appreciate your suggestion.
:?0 -
So you're trying to import the entire csv line into one variable then break it up? there are easier ways of accomplishing this.
You want to use a codeunit or dataport?0 -
Hi Savatage,
Actually, I used codeunit to import the file.
It's done now. O:)0 -
Hi,
can someone please post a code sample? I have a similar problem...
Best Regards,
Gregor0 -
Take a look at the online help of NAV, function READ of DataType File:Remarks
If TEXTMODE Function (FILE) is set to true, a line of text from the file is read, evaluated, and the variable is set equal to the result.
If TEXTMODE is set to false, the number of bytes to read is determined by the size of the variable."Money is likewise the greatest chance and the greatest scourge of mankind."0 -
I have a problem with reading from a file with a total length more than 1024 chars.
I have created a file with 5 lines. Each line has a text with length of 500.
The the code below is ran:f.TEXTMODE := FALSE; f.OPEN('C:\test.txt'); f.READ(InStr);
Note that InStr is a text variable with 1024 length.
The following error occurs:
Microsoft Dynamics NAV
The text 'aaaaaaaaaa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is too long.
OK
I have also tried to change Instr to a shorter length, like 80 chars, and I still get the error.
Is there something wrong with the way this is coded?0 -
hi,
I found my solution in --> viewtopic.php?f=23&t=29313&p=146950#p146950
using BigText is so much simpler.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