EXPORT Function (XMLport)

Creates an XML data stream (XML document) and sends it to a chosen destination.

[Ok :=] XMLPORT.EXPORT(Number, OutStream[, Record])

Parameters

  • Number
    Type: Integer The ID of the XMLport that you want to run. Instead of the ID number, you can specify the name of the XMLport by using the following syntax: XMLPORT.EXPORT(XMLPORT::CustomerXMLport, XmlStream). For more information, see Walkthrough: Exporting Data from Tables to XML Documents.
  • OutStream
    Type: ISequentialStream Where the XMLport object will write the XML data stream.
  • Record
    Type: Record The record to use in the XMLport. Any filters attached to the record will be used. This parameter is optional. If this parameter is omitted, all records in the table are exported.

Example

The following example exports data from a table to an XML document. The code uses the CREATE Function (File) to create an XML file named CustXmlFile.xml in a folder named xmlData on the C drive. The CREATEOUTSTREAM Function (File) opens a data stream to output the data from the table to the XML file. The EXPORT Function (XMLport) then exports the data and saves it at the specified location. The CLOSE Function (File) closes the data stream. This example assumes that you have created a folder named xmlData on the C drive. This example requires that you create the following variables in the C/AL Globals window.

Variable name DataType Subtype

CustXmlFile

File

Not applicable

XmlStream

OutStream

Not applicable

varXmlPort

XMLport

50002

This inserts the name of the XMLport.

CustXmlFile.CREATE('C:\XmlData\Customer.xml');
CustXmlFile.CREATEOUTSTREAM(XmlStream);
XMLPORT.EXPORT(50002, XmlStream);
CustXmlFile.CLOSE;

See Also

Reference

XMLport Data Type

Concepts

Designing XMLports