Designing a dataport consists primarily of setting various properties. The following sections explain which properties to use, and how to use them.

For an example of how to define dataports, see Walkthrough: Creating a Dynamic Dataport.

Dataport Design

The following table lists the components of a dataport object.

Dataport component Description

Dataport description

A complete description of the dataport including how data is collected, how data is formatted when written to the output file, and so on. The dataport description is stored in the database.

Data item

A data item corresponds to a table in the database. You define data items so that you can retrieve information from the tables in the database. A dataport must contain at least one data item, and each data item defines one or more fields.


A dataport field can be a field in a data item (a database table), a field in a file from which data is to be imported, or a source expression to be executed during import or export. Fields in the external file are defined either as having a fixed length, or as being delimited by certain characters that you define.

Request form

A request form is a form that is run before the dataport is executed. The request form is used to gather requests and options from the user, for example, the name and location of the external file.


Dataports can be run without user interaction. In that case, the C/AL code that calls the dataport must provide any required information, such as the name and location of the external file.


The dataport itself, and data items, fields, and the request form have properties that characterize the object in some way. For example, the length and position of a field in a line during import, or whether the OnValidate trigger of a field should be executed when inserting imported data into a table. Properties are set in the Properties window of an object during design time. Also, the request form for a dataport contains fields that set properties on the dataport and its data items.


Certain predefined events that happen to a dataport cause the system to execute a user-defined C/AL function—the event triggers the function. Triggers are available for the dataport itself, the data items, the fields, the request form, and the controls on the request form. You can edit triggers in the C/AL editor. For more information, see Triggers on Dataports Overview.

Defining File Formats

The file format you set for a dataport determines which properties are available for that dataport. For example, if you set the file format to Variable, the FieldEndDelimiter, FieldStartDelimiter, and FieldSeparator properties become active. For more information, see Properties for a Dataport.

The FileFormat property determines the format of the external file and defines how a record is read from or written to the file. The RecordSeparator property defines how the file is broken into records, and the FileFormat property then defines how to break each record into fields. Finally, the DataItemSeparator property defines how data items should be separated if the dataport has more than one data item.


Data items cannot be nested, although a dataport can have several data items that are processed sequentially.

Defining Fields in Records

When the format of the external file is Fixed, the fields in a record have a fixed width. You can define the starting position and the width of each field in the record. If the record separator is a new line character, a record is essentially a line of text. For more information, see Properties for a Field on a Dataport Data Item.

When the format of the external file is Variable, the fields in a record are delimited by characters that you define, and the fields can have varying widths. The fields are separated by the string defined as the FieldSeparator property. For more information, see Properties for a Field on a Dataport Data Item.

See Also