Write Text File Does Not Work in RTC, Works Fine in Classic

matttrax
Member Posts: 2,309
Strangest thing. I am creating a text file using files and streams in a Codeunit. When I create this file from the Classic Client it comes out great. When I create the same file, in the same folder, on the same server, it writes blank lines equal to number of lines it should have written, and then a partial piece of the last line, everything but the first two characters.
The output to the file is from a BigText variable and is done via BigText.WRITE(Buffer). I checked this post, viewtopic.php?f=32&t=34321&hilit=bigtext, and I am doing everything the same way. I have also confirmed via message prompts directly before the writes that the BigText variable contains what I want to write to the file, but it should since it works fine in Classic.
I thought that maybe I would need to write it directly to a drive on the service tier for some reason, but that didn't work either.
Has anyone experienced this before? I am at a complete loss at this point. ](*,)
The output to the file is from a BigText variable and is done via BigText.WRITE(Buffer). I checked this post, viewtopic.php?f=32&t=34321&hilit=bigtext, and I am doing everything the same way. I have also confirmed via message prompts directly before the writes that the BigText variable contains what I want to write to the file, but it should since it works fine in Classic.
I thought that maybe I would need to write it directly to a drive on the service tier for some reason, but that didn't work either.
Has anyone experienced this before? I am at a complete loss at this point. ](*,)
0
Comments
-
Here's the actual test code.
MyBigText.ADDTEXT('MyBigText'); NewLine1 := 13; NewLine2 := 10; Filename := 'C:\Users\mtraxin\Documents\MattTest.txt'; IF NOT MyFile.CREATE(Filename) THEN MyFile.OPEN(Filename); MyFile.CREATEOUTSTREAM(MyStream); FOR i := 1 TO 10 DO BEGIN MyBigText.WRITE(MyStream); MyStream.WRITE(NewLine1); MyStream.WRITE(NewLine2); END; MyFile.CLOSE;
In Classic it produces this:
"MyBigText
MyBigText
MyBigText
MyBigText
MyBigText
MyBigText
MyBigText
MyBigText
MyBigText
MyBigText
"
In the RTC it produces this:
"
BigText"
If it is a text variable it works fine in both, but not with BigText. I am going to have to do a TextArray for the time being, but I would love to know what is going on here.0 -
ok now i got it, your problem is the position in the stream. Everytime you write directly in the stream the cr/lf you overwrite your data... try without the CR/LF part and you get your Text 'MyBigText' repeated 10 times.
Add this:MyBigText.ADDTEXT(FORMAT(NewLine1)+FORMAT(NewLine2));
instead of writing it in the stream0
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