Contact Free trial Login

Get a Recommendation for Mapping Data Types for a Transformation

In the Transform card, you can view recommendations for how to map the data elements in an input data type to the data elements in an output type. If a recommendation suits your needs, you can save the mapping and use it in the card.

About this task

The Transform card works by converting messages from the previous card in a flow to an output messages that can be consumed by the next card. A message can consist of a payload, attributes, and variables. In this image, the Transform card is placed between and HTTP Listener card and an HTTP Request card. The Transform card can accept messages (which contain data in JSON or in some other format) from the HTTP Listener and transform them into messages that the HTTP Request card is configured to accept.

simple flow

There are two different views in the card that let you specify how to transform input messages to output messages: the Script view and the Mappings view.

In the Script view, you can write a DataWeave script. However, if you are not familiar with DataWeave, you can use the Mappings view.

This view shows the expected structures of the input and output messages. Mappings between these two trees are represented by lines that connect input to output fields. You can map input fields to output fields by dragging and dropping fields from the input to fields in the output.

simple transform card example

If you are not sure how to map an input data type to an output type, you can have the Transform card recommend mappings between them.

Limitations

  • The card does not make recommendations for mapping input attributes to output attributes or input variables to output variables.

  • Elements of an array that is itself an element in an array are ignored in the recommendations. For example, both d and e in this data type are ignored:

    {
    	"a": [
    		"b": 1,
    		"c": [
    			"d": 2,
    			"e": 3
    			],
    		]
    }

    In this data type, both e and f are ignored:

    {
    	"a": [
    		"b": 1,
    		"c": {
    			"d": [
    				"e": 2,
    				"f": 3
    				],
    			},
    		"g": 4
    		],
    }
  • The card does not create mappings between different data types. For example, if an element in an input data type is an integer, the card maps it only to another integer, never to a string or other data type.

Before you begin

Ensure that the Automapping feature is enabled for your organization in Anypoint Platform.

  1. In Anypoint Platform, open Access Management.

  2. Under Settings on the left side of the screen, click Flow Designer.

  3. On the Flow Designer General Settings page, click the circle in the Enable column.

The recommendation system works by collecting and analyzing anonymized data from all users of Flow Designer who are using CloudHub. Enabling this feature enables the collection of anonymized data for improving recommendations. If you have any concerns about sharing even anonymized data, do not enable this feature.

Procedure

  1. Set your output data type in the card that precedes the Transform card.

  2. Set your input data type in the card that follows the Transform card.

  3. Open the Transform card to the Mappings pane in the Configuration section.

  4. Click the Preview button that is at the top of the pane.

Result

The recommendation for mapping the input data type to the output data type appears in orange.

What to do next

If you find the recommendation fits your needs, click the Apply button at the top of the Mappings pane.

If the recommendation does not fit your needs, click Discard. The recommendation is removed from the pane. If you want to see a recommendation again, close and reopen the Transform card and click Preview.

Was this article helpful?

💙 Thanks for your feedback!

Edit on GitHub