Nav
You are viewing an older version of this section. Click here to navigate to the latest version.

Editing Metadata

Version 3.3.1 only

During development, you may wish to make changes in the data structure definitions for mapping. For example, it may be necessary to add, edit or remove elements in lists containing the values for mapping. To address this need, Anypoint DataMapper allows you to add, edit, or remove the data structures definitions in the Input or Output panes of the DataMapper View.

This feature is available for the following formats:

  • XML

  • JSON

  • CSV

  • Map

This document assumes the reader is familiar with the DataMapper Transformer. Consult the DataMapper Transformer Reference for details.

Configuration Employed In These Examples

The following sections illustrate how to add, edit and remove fields in a JSON to XML data map. Though the examples pertain to the JSON input data, the same procedures apply for the XML output data. The DataMapper transformer uses the following configuration:

View the input JSON sample file

View the XML file used to generate the XML schema

The DataMapper View for the DataMapper transformer (see image below) displays two lists, contacts and emergency contacts. Each list contains the following values:

  • name

  • lastname

1

Adding a Field

Complete the procedure below to add a phone field, with the attributes listed below, in the contacts list of the Input pane.

  • Type: Attribute

  • Name: Phone

  • Configuration Type: String

    1. Right-click the parent element to which you want to add the field. In this case, select contacts.

    2. Select Add Field.

      2

    3. In the New Attribute window, click the drop-down menu next to Type, then select Attribute.

    4. In the Name input box, type the name of the new field, in this case, phone.

    5. In the Configuration section, click the drop-down menu next to Type, then select String.

      3

    6. Click OK to add the new field, which appears under contacts.

      4

Use the same procedure to create a corresponding field in the Output pane, then create a mapping between the fields.

5

Editing a Field

Complete the following procedure to edit an existing Input or Output field.

  1. Right-click the field, then select Edit Field from the drop-down menu.

    6

  2. In the Edit Attribute window, edit the parameters for the field.

    7

Deleting a Field

Complete the following procedure to delete an existing Input or Output field.

  1. If the field you wish to remove maps to another field, remove the mapping by selecting the Output field, then clicking the red X in the Current Element Mapping pane.

  2. Right-click the field you wish to delete, then select Remove Field from the drop-down menu.

    7-2

  3. Click to confirm field removal.