Updated on 2024-05-16 GMT+08:00

Data Mapper

The data mapper processor is used to convert the data format. Subsequent nodes can reference the output data from a data mapper using ${payload}.

Configuration Parameters

Parameter

Description

Source Data Source

If the data source is a database, the field information is automatically displayed after a table is selected. In other cases, manually add fields or import a file. Only JSON, XML, and CSV files can be imported.

Destination Data Source

If the data source is a database, the field information is automatically displayed after a table is selected. In other cases, manually add fields or import a file. Only JSON, XML, and CSV files can be imported.

Subsequent nodes can reference the output data of a data mapper processor using ${node ID|payload.xxx}. The node ID is displayed after you click a data mapper node.

Destination - XML Data Example

When destination data source format is XML, Root Tag defaults to root. You can set this parameter to other values but cannot leave it empty.

Data in the demo.statistics table of the source MySQL database:

id

city

uuid1

suzhou

uuid2

shanghai

Mapping result:

<root>
    <custom>
        <key1>uuid1</key1>
        <key2>
            <level2>suzhou</level2>
        </key2>
    </custom>
    <custom>
        <key1>uuid2</key1>
        <key2>
            <level2>shanghai</level2>
        </key2>
    </custom>
</root>

Destination - CSV Data Example

Header: Whether to include the table header of the CSV file in the output. Options are true and false.

Delimiter: Data in each file column is separated by cells, which can be represented as tab characters, spaces, commas, or semicolons.

Scenario 1: Set the destination data source format to CSV, Header to true, and Delimiter to comma.

When a file is imported, if Header is set to true, the first line of the CSV file is the field names.

Data in the demo.statistics table of the source MySQL database:

id

city

uuid1

suzhou

uuid2

shanghai

Mapping result:

ManufacturerId, ProductName
uuid1, suzhou
uuid2, shanghai

Scenario 2: Set the destination data source format to CSV, Header to false, and Delimiter to comma.

When a file is imported, if Header is set to false, the header field of the imported file is not used. The filedN field is used by default.

Data in the demo.statistics table of the source MySQL database:

id

city

uuid1

suzhou

uuid2

shanghai

Mapping result:

uuid1, suzhou
uuid2, shanghai