Help to create and dump a text file needed

merril
Member Posts: 38
I'm trying to create a text file with data in. I looked in the help and found the following code:
Thanks in advance.
Regards,
Merril
OutFile.TEXTMODE(TRUE); OutFile.WRITEMODE(TRUE); OutFile.CREATE('c:\msr.txt'); gbolFileCreated := TRUE; OutFile.CREATEOUTSTREAM(OutStream); OutStream.WRITETEXT('To: someone@somewhere.com'); OutStream.WRITETEXT(); OutStream.WRITETEXT('From: "Navison NAS" <superawesomeperson@somewhere.com>'); OutStream.WRITETEXT(); OutStream.WRITETEXT('Subject: Whatever'); OutStream.WRITETEXT(); OutStream.WRITETEXT('MIME-Version: 1.0'); OutStream.WRITETEXT(); OutStream.WRITETEXT('Content-Type: text/html;'); OutStream.WRITETEXT(); OutStream.WRITETEXT(' charset="iso-8859-1"'); OutStream.WRITETEXT(); OutStream.WRITETEXT('Content-Transfer-Encoding: quoted-printable '); OutStream.WRITETEXT(); OutStream.WRITETEXT('BODY OF EMAIL HERE<br>'); OutStream.WRITETEXT('Additional Lines below!!!!'); OutFile.CLOSE();I have declared the Outfile as type File. But when I compile this code, I get an error
What is the problem here? Is this the best way to create a text file with data in?type of conversion is not possible because 1 of the operators contains an invalid type . Outstream. := Type
Thanks in advance.
Regards,
Merril
0
Answers
-
BTW : it is possible that the error is created by the
OutStream.WRITETEXT();
maybe you should put this (didn't try it):OutStream.WRITETEXT('');
But the outstream is not really necessary.
Try this:OutFile.TEXTMODE(TRUE); OutFile.WRITEMODE(TRUE); OutFile.CREATE('c:\msr.txt'); OutFile.WRITE('To: someone@somewhere.com'); OutFile.WRITE(''); OutFile.WRITE('From: "Navison NAS" <superawesomeperson@somewhere.com>'); OutFile.WRITE(''); OutFile.WRITE('Subject: Whatever'); ... OutFile.CLOSE();
Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
OutStream.WRITETEXT();
This statement should work fine,
How do you have your variables declared?
The code you have supplied works fine for me, are you sure you have declared 'OutStream' as datatype OutStream? (Also you might want to use less ambiguous variable names. How about 'oStream' ?)0 -
I thought it isn't possible to name an OutStream variable "OutStream". :?"Money is likewise the greatest chance and the greatest scourge of mankind."0
-
einsTeIn.NET wrote:I thought it isn't possible to name an OutStream variable "OutStream". :?
Yeah I was thinking somewhat the same, until I tried it out 8-[0 -
I have declared Outfile as File. If I declare Outstream as type outstream, I get an error: "The variable outstream is defined more than once"0
-
merril wrote:I have declared Outfile as File. If I declare Outstream as type outstream, I get an error: "The variable outstream is defined more than once"Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!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