Contact Us 1-800-596-4880

Anypoint DataMapper Visual Reference (Deprecated - DataMapper)

DataMapper continues to be fully supported in all current and future versions of Mule 3.x, however it will be removed in Mule 4.0 in favor of the Transform Message component (based on DataWeave code). We recommend that if you wish to take advantage of the new capabilities of DataWeave or if you start new projects, upgrade now.

A migration tool is now included in Anypoint Studio, which assists in converting a DataMapper map to DataWeave. From the Anypoint Studio Canvas, right-click a DataMapper building block, select Migrate to DataWeave, and follow the instructions.

A window for creating a mapping from CSV to JSON

If you don’t see DataMapper on your palette, you can enable it by going to Preferences > Anypoint Studio > Palette Profiles and clicking the checkbox Show deprecated Mule Components and Attributes.

This page contains annotated images of all of the major views used in Anypoint DataMapper. It is meant as a reference for the discussions in the rest of the DataMapper documentation, to help identify each control in the UI.

DataMapper Configuration Overview

To use a DataMapper transformer in your application, you perform the following high-level tasks:

  1. Drag a DataMapper transformer from the Studio Palette to the canvas, and place it in the desired location in your flow.

  2. Click the DataMapper transformer in the flow. Studio will display the DataMapper properties editor, shown below.

    A form with input and output fields for configuring the DataMapper
  3. Define the input and output properties for your mapping (this step is required for actually creating the mapping). The required tasks are:

    1. Define the Source of your input data.

    2. Define the Type for your input data.

    3. Define the Target for your output data.

    4. Define the Type for your output data.

To define the type for your input data, click the edit icon A pencil on a notepad icon or the dropdown menu next to the Type input field. DataMapper displays a mapping configuration view according to the input type you selected. The following image displays the configuration view for input type CSV.

A window displaying a DataMapper interface with sections for input and output configuration

Using this window, you define the input and output mapping properties, including data types and fields (for details, see Defining DataMapper Input and Output Metadata).

  1. After defining the mapping properties, click the Create mapping button at the bottom of the editor. The properties editor becomes the graphical mapping editor, shown below, in which you can define your data mapping proper.

    A tool for mapping data from CSV to XML format
  2. Define your mapping, adjusting or mapping fields as necessary.

DataMapper Properties Editor Overview

The image below describes the different icons, indicators and tools in DataMapper’s properties editor. For a description of each item, consult the numbered table below the image.

For details on creating your mapping, see Defining DataMapper Input and Output Metadata.

A form for configuring data mapping input and output

Notice the Create mapping button at the bottom of the image above. The button is grayed-out; it’s available only after you define the input and output parameters for your mapping.

Number Description

1

Display name input field. Defines the name for this DataMapper in the application flow as shown in the Studio canvas.

2

File name input field. Defines the name of the file that contains the data mapping.

3

Input source drop-down menu. By default, DataMapper takes its input from the message payload. Click to select another input source; you can select from several message properties or flow variables.

4

Input type input field. Click the edit icon A pencil on a notepad icon or the dropdown menu next to the Input Type field. This causes the input pane to change allowing you to select between the available types for input data.

5

Output target input field. The default is the message payload. Select between payload or available properties, or write your own expression.

6

Output type drop-down menu. Click to select between the available types for output data.

7

Inbound/outbound properties view selector, available when the metadata view is enabled (see below).

8

Sidepanel view selector and config icons. Use these icons to:

  • A table icon with several rows and columns / A logo with a gold plus sign Toggle between the mapping view and the DataMapper configuration view.

  • A floppy disk icon Save the DataMapper properties

  • A question mark icon Obtain help

9

Input or output properties, selectable with the inbound/outbound properties view selector (item 7 in this table)

Overview of the Graphical Mapping Editor

The image below describes the different icons, indicators and tools in DataMapper’s graphical mapping editor. For a description of each item, consult the numbered table below the image.

For details on defining your mapping, see Defining DataMapper Input and Output Metadata.

A software interface for mapping data between a CSV file and an XML file
Number Description

1

Infer Metadata tool for input metadata. Click to reload or recreate your mapping’s input metadata without having to reconfigure your mapping flow from scratch. See Defining DataMapper Input and Output Metadata for details.

2

Add tool for input data. Click to add elements to the mapping, including:

  • Metadata fields

  • Rules

  • Input and output arguments

  • Lookup tables

3

Remove Selected Field ** tool. Select a field, then click the tool to remove the selected field.

4

Input Properties tool. Click to open the Properties configuration window. Configurable properties will vary according to the input type. The image below shows the Properties configuration window.

A dialog box for editing CSV format properties, including encoding, delimiters, and quote characters

5

Show/Hide Unrelated Elements tool. Default position is open, showing the hide icon A line crossing out an eye icon.

  • When open, displays all elements in the input mapping pane that are not collapsed, whether or not you can map them in the current mapping level.

  • When closed, hides all elements in the input pane that are not mappable in the currently displayed mapping level.

6

Input pane Search Filter. Type a string to display only elements in the input data that contain the string.

7

Current Element Mapping indicator/drop-down menu. Indicates the currently-displayed mapping level for multiple-level data mappings such as nested lists. The drop-down menu allows you to instantly switch between mapping levels.

8

Add Mapping icon: Click to add a new mapping. DataMapper displays the Structure mapping editor configuration window, displayed below.

A form with fields for Name, Condition, Source, and Target, and buttons for Cancel and OK

In the Name field, type a descriptive name for the new mapping.

In the Condition field, type an optional XPath condition. If you define a condition, the mapping only processes source elements that match the condition.

The Condition field is only displayed when input type is XML.

For more information on structured mapping, see Example: Flat-to-Structured and Structured-to-Flat Mapping.

9

Edit Mapping tool. Click to modify the name of the current mapping level.

10

Remove Mapping tool. Click to remove the current mapping level.

11

Infer Metadata tool for output metadata. Click to reload or recreate your mapping’s output metadata without having to reconfigure your mapping flow from scratch. See Defining Input and Output Metadata for details.

12

Add tool for output data. Click to add a metadata field to the output mapping.

13

Remove Selected Field ** tool. Select a field, then click the tool to remove the selected field.

14

Click Field Assignments tool. Click to delete the selected field(s) assigned input values. To clear the values of multiple fields, select the fields by clicking the first field, holding down the SHIFT key and scrolling over the adjacent fields.

15

Output Properties tool. Click to open the Properties configuration window. Configurable properties will vary according to the input type. Shown here are

16

Show/Hide Unrelated Elements tool. Default position is open, showing the hide icon A line crossing out an eye icon.

  • When open, displays all elements in the input mapping pane that are not collapsed, whether or not you can map them in the current mapping level.

  • When closed, hides all elements in the input pane that are not mappable in the currently displayed mapping level.

17

Output pane Search Filter. Type a string to display only elements in the output data that contain the string.

18

Graphical view button. Click to display DataMapper’s graphical view, displayed by default and illustrated in Overview of the Graphical Mapping Editor.

19

Script view button. Click to display DataMapper’s script view. For details, see Overview of the Script View.

20

Preview button. Click to display DataMapper’s preview pane, where you can run a preview of your mapping. For details, see Overview of DataMapper Preview.

Overview of the Script View

A screenshot of a program with multiple sections showing how to convert CSV to XML data
Number Description

1

Field nav pane filter box. Type a string to see only fields whose names contain that string.

2

Input and output information pane. Here you can access information about input and output fields and arguments, lookup tables, and default functions. You can also insert an input or output field or a function into the script by click-and-dragging the function from the information pane to the script editor.

3

Current Element Mapping indicator/drop-down menu. Indicates the currently-displayed mapping level for multiple-level data mappings such as nested lists, and allows you to select which mapping level to view and edit.

4

Script view button. Click to select the Script view.

5

Input or output properties, selectable with the inbound/outbound properties view selector.

6

Script editor. Click anywhere in the script to edit.

7

Default Functions in the input and output information pane. To insert a function into the script, click and drag the function to the desired location in the script editor.

Overview of DataMapper Preview

DataMapper’s preview feature allows you to test your mapping using a specific input file and preview the results. For details, see Previewing DataMapper Results on Sample Data.

A button with the label
Number Description

1

Input Data input field. Use to select the path of the file to read data from. Alternatively, click the folder A folder with a arrowbutton to the right of the field to select the file using your system’s file browser.

2

Text / Graphic View selector. Click to switch between graphic view (default, below left) and text view (below right).

A list of employee data, including phone numbers, zip codes, addresses, and names Code showing a list of employee data including phone number, zipcode, street, name, last name, and employee number

3

Folder icon for selecting the input file. Click to select the file using your system’s file browser.

4

New input file icon. Click to create a new input file and save it to disk. The default location for the file is inside your application’s folder tree. After creating a new input file, you can click it in the package explorer to edit it inside Studio.

5

Input Arguments button. Click to enter input arguments for your preview (for details, see "Using Data Mapping Input and Output Arguments" in Building a Mapping Flow in the Graphical Mapping Editor).

6

Run button. Click to run a preview of your mapping and display the results.

7

Preview button. Click to display the Preview.

8

Input or output properties, selectable with the inbound/outbound properties view selector.

9

Preview results pane. Displays the results of the preview in graphic or text format.

The DataMapper Configuration View

The A table icon with several rows and columns / A logo with a plus sign buttons to the right of the graphical mapping editor allow you to toggle between the mapping view and the DataMapper configuration view. The configuration view allows you to quickly configure global parameters for your specific DataMapper transformer.

A form with fields for configuring a CSV to JSON conversion
Number Description

1

Display name input field. Defines the name for this DataMapper in the application flow as shown in the Studio canvas.

2

Drop-down menu for referencing any of the mapping files (ending in .grf) available in the application. By default, the mapping file created for this specific DataMapper is referenced. Selecting another mapping file causes the DataMapper transformer to replicate the mapping in the referenced file.

3

Operation selector drop-down menu. In most cases, only the default Transform operation is available.

4

Input source input field. Here you can use Mule Expression Language to select an input source other than the message payload, such as message inbound properties, ID, etc.).

5

Output target input field. Here you can use an enricher expression to enrich the current message with the result of DataMapper processing.

6

Return class input field. Enter the class name of the expected output.

7

Streaming checkbox. Click to enable streaming on this DataMapper. For details on streaming, see Streaming Data Processing with DataMapper.

8

Pipe size input field for streaming. Defines the size of the streaming cache. Default is 2048 bytes when working with files, or 2048 elements when working with collections.

9

Input arguments field generator/editor. Use to add input arguments to the mapping. For details, see "Using Data Mapping Input and Output Arguments" in Building a Mapping Flow in the Graphical Mapping Editor.