Configure different XMLport properties

Completed

XMLport properties define the basic characteristics of the input or output files that XMLport will access. The properties of the XMLport nodes describe the data source and define the behavior of the XMLport during import and export operations.

Properties

Generally, XMLport properties describe the XMLport. Several properties, such as Direction and FileName, can be set and reset dynamically. For example, developers can create an XMLport where the user can do one of the following actions:

  • Select whether to import or export.

  • Select the external source to read from or write to.

  • Generate a file name automatically when the XMLport is run.

The FileName property can only be used in an on-premises environment because you can't access local files in a software as a service (SaaS) environment.

Direction property

The Direction property defines whether the XMLport can handle import, export, or both. The following property options are available:

  • Import

  • Export

  • Both

The default for the Direction property is Both.

The Direction property strictly defines how an XMLport can be used. If the direction is explicitly set to Import or Export, then the XMLport can't be used to handle documents in the opposite direction. If you want an XMLport to handle the importing and exporting of documents, make sure that this property specifies the direction of Both.

DefaultFieldsValidation property

The DefaultFieldsValidation property determines whether fields will be validated during import or assigned. This setting can be overridden for a specific field by specifying the FieldValidate property on the field.

UseRequestPage property

The UseRequestPage property specifies if the XMLport will display a request page that has options and filters. If this property is set to false, then the XMLport will continue directly to import or export, depending on the value of the Direction property. If this property is set to Both, then the request page will provide a choice of Import or Export, where the default is Import.

Triggers

Triggers are predefined functions that run when certain events occur. The bodies of these functions are first empty and can be defined by a developer. Writing AL code in triggers lets developers change the system's default behavior.

The following types of triggers are specific to XMLports:

  • XMLport

  • Node

  • Request page

Format

Concerning data exchange between applications, XML provides many advantages over text format. XML structured data means integrity, increased flexibility, and better human readability. XML format also provides extensibility, such as attaching schemas to achieve data validation or applying style sheets to transform the data into a completely different XML structure.

Despite these powerful features, situations might occur where data must be exchanged in a plain text format. Several legacy systems don't support XML or can't easily handle data in XML format. Additionally, many external applications, such as Microsoft Excel, can produce or read data in text format. To simplify this exchange, XMLports can also export and import data in text format in addition to XML format.

Though text formatting rules are not as strict as those imposed by XML format, data in text files must be structured in a way that a computer can easily manipulate.

Two ways to structure plain text data are:

  • Variable text

  • Fixed-width

With variable text format, columns are separated by using a delimiter such as a comma, colon, or tab character. Fixed-width format requires that each column of data has a fixed length for characters.

The Format property of an XMLport determines the type of the file you want to import or export. It has three possible values:

  • FixedText

  • VariableText

  • XML

Properties for handling text files

Several XMLport object and XMLport node properties are specific to handling text files:

  • Width - Determines the width of the fixed-width field. If FixedText is selected in the Format property, all elements and attributes of the text and field types should have their Width property value set to greater than zero or compilation errors will be generated.

  • FieldDelimiter - Determines the text delimiter for a field. The default value is a double quotation mark (").

  • FieldSeparator - Determines the field separator for fields. The default value is a comma (,).

  • RecordSeparator - Determines the record separator for records. The default value is <NewLine\>.

  • TableSeparator - Determines the table separator for tables. XMLports can import or export data from or into several tables concurrently. The tables are separated in the file by the table separator. The default value is <NewLine><NewLine\>.

When variable text or fixed-width formats are used, it doesn't matter if you use Element or Attribute as node types. However, you must still order all attributes above all elements, and you can't use more than one level of hierarchy below an element of the Table source type.