The AL developer preview is still evolving with frequent updates. Follow us on the Dynamics NAV Team Blog for the announcements.
CREATEOUTSTREAM Method (File)
Creates an OutStream object for a file. This enables you to export or write data to the file.
Use this variable to refer to the file.
The OutStream object type that has been created.
The following example uses the CREATEOUTSTREAM method to export data from a table to an XML document. The code uses the CREATE Method (File) to create an XML file that is named CustXmlFile.xml in a folder that is named xmlData on drive C. The CREATEOUTSTREAM Method (FILE) opens a data stream to output the data from the table to the XML file. The EXPORT Method (XMLport) then exports the data and saves it at the specified location. The CLOSE Method (File) closes the data stream. This example assumes that you have created a folder named xmlData on drive C. This example requires that you create the following global variables.
This inserts the name of the XMLport.
CustXmlFile.CREATE('C:\XmlData\Customer.xml'); CustXmlFile.CREATEOUTSTREAM(XmlStream); XMLPORT.EXPORT(50002, XmlStream); CustXmlFile.CLOSE;