Upload a .txt file through the RTC into Excel Buffer Table
TESDarrenA
Member Posts: 11
Hi,
I am having a few issues, when using the RTC, I am running a codeunit which reads in a .txt by char and inserts it into the Excel buffer table. If I run the codeunit through Classic it works perferct but through the RTC I get the error:
Invalid data encountered in Stream, unable to read text.
Code:
Is there an easier way of possibly doing this, I tried this way as the .txt file contains lots of ,'s and "? ](*,) ](*,) ](*,)
Please note that it doesn't get into my CreateHeader function but it does read in every chr from the file (I inserted every Chr into a table to test) but then I get the above error.
Do I have to tell it to stop reading in or commit it somewhere?
Thanks for your time.
Darren A
I am having a few issues, when using the RTC, I am running a codeunit which reads in a .txt by char and inserts it into the Excel buffer table. If I run the codeunit through Classic it works perferct but through the RTC I get the error:
Invalid data encountered in Stream, unable to read text.
Code:
ImportCSVtoExcelBuffer(VAR VfilFile : File;VAR RrecExcelBufferTemp : TEMPORARY Record "Excel Buffer";VchrSeperator : Char;VchrQualifier
RrecExcelBufferTemp.RESET;
RrecExcelBufferTemp.DELETEALL;
LintRowCount :=1;
LintColumnCount :=1;
VfilFile.TEXTMODE(FALSE);
VfilFile.SEEK(0);
WHILE LintFileCount <= VfilFile.LEN DO BEGIN
LintFileCount+=1;
VfilFile.READ(LchrReadInChar);
CASE LchrReadInChar OF
VchrSeperator:
BEGIN
RrecExcelBufferTemp.INIT;
RrecExcelBufferTemp."Row No." := LintRowCount;
RrecExcelBufferTemp."Column No." := LintColumnCount;
RrecExcelBufferTemp."Cell Value as Text" := LtxtReadInText;
RrecExcelBufferTemp.INSERT;
LintColumnCount +=1;
LtxtReadInText :='';
END;
VchrQualifier:
BEGIN
END;
VchrLineBreak:
BEGIN
RrecExcelBufferTemp.INIT;
RrecExcelBufferTemp."Row No." := LintRowCount;
RrecExcelBufferTemp."Column No." := LintColumnCount;
RrecExcelBufferTemp."Cell Value as Text" := LtxtReadInText;
RrecExcelBufferTemp.INSERT;
LintRowCount +=1;
LintColumnCount :=1;
LtxtReadInText :='';
END;
ELSE BEGIN
IF (LchrReadInChar >=32) AND (LchrReadInChar <=126) THEN
LtxtReadInText := LtxtReadInText + FORMAT(LchrReadInChar);
END;
END;
END;
CreateHeader(RrecExcelBufferTemp);
EXIT(LintRowCount-1);
Is there an easier way of possibly doing this, I tried this way as the .txt file contains lots of ,'s and "? ](*,) ](*,) ](*,)
Please note that it doesn't get into my CreateHeader function but it does read in every chr from the file (I inserted every Chr into a table to test) but then I get the above error.
Thanks for your time.
Darren A
0
Comments
-
Or has anyone imported a text file through the RTC to create records for example in tb 36 & tb 37
This is getting really urgent now.
Hope someone can help :-k0
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
- 322 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