Tour of the Transform Card (Flow Designer)
The Transform card contains numerous features to make it easy for you to map data.
The Transform card has four sections: Configuration, Input, Output, and Notes. The last three sections are common to all cards. While the Notes section can be very useful for explaining the work you have done in the Transform card or writing instructions to other people who might use your application as a template, you do not use the Input and Output sections in this card.
The card’s type and name. As with other cards, you can rename the card from the default name
DataWeaveto any name that suits your purposes.
This banner indicates whether Flow Designer has mapping suggestions for you. When it does, the banner looks like this:
See "Get a Recommendation for Mapping Data Types for a Transformation" to learn when Flow Designer can make mapping suggestions for you.
The Input pane shows the output from the previous card. The Transform card displays the three parts of the output: the payload, attributes, and variables. If the payload is not a simple data type, you might need to specify the data type that it uses. You might need to do the same for attributes, variables, or both.
- Supported simple data types
Boolean, Date, DateTime, Integer, Number, String
- Other supported data types
CSV, JSON, Object, XML
You can specify the data type by clicking the three dots to the right of
varsto open the Data Type Actions menu.Figure 2. The menu for setting the data type for a payload, attributes, and variables in the Input pane
You can create the data type that you need or select it if you created it earlier. See "Data Types" to learn more.
Here you can switch between sections of the Transform card by clicking their names. (The name of the Notes section is not pictured.)
Here you can switch between the panes of the Configuration section. In the image, the Mappings pane is selected and open.
The Preview pane shows a preview of the output of the Transform card. Before a preview can appear, you must map the input of the Transform card to the output. When no preview is yet available, the pane looks like this:
This pane provides one method of mapping data. You can drag elements of the Input pane onto elements of the Output pane.
The Output pane displays the elements that will be in the payload of the output of the Transform card and passed to the next card in the flow. Flow Designer usually populates this pane by detecting the data structure that is required by the next card in the flow.
If any of the elements in the output require data that they cannot acquire by being mapped to an element of the input, you can specify that data with a string, a number, or a DataWeave expression. Double-click the element to open this small dialog for editing the element’s value:Figure 4. The dialog that is opened when you double-click an element of the output
By default, the value is
null. You can specify the value you want by typing directly in the dialog.Figure 5. Changing the value to a telephone number
After you click OK, both the
f(x)symbol and a trash-can icon appear to the left of the element. The
f(x)symbol indicates that the value is set manually to a string, number, or DataWeave expression. Clicking the trash-can icon removes the value, but it does not remove the element.
If the Flow Designer is unable to detect the data structure that is required by the next card in the flow, the Output pane looks like this:Figure 6. The Output pane when Flow Designer cannot detect the required data type for the card that comes after the Transform card
You can create or specify the data type to use for the payload.
This area shows which elements of the input to the Transform card are mapped to which elements of the output. To map elements together, you can click an element of the input and drag it to an element of the output. An alternative is to create a DataWeave script that maps elements. You can do this in the Script pane.
As you map on the Mappings pane, the Transform card generates the corresponding DataWeave script in this pane. If you know DataWeave scripts, you can customize the mapping. You could even skip using the Mappings pane and write your own DataWeave script instead. To learn about DataWeave, see "DataWeave Language".
When the following three conditions are true, you can use this pane to provide an example usage of the data type that is used for the output of the previous card:
You want to see a preview of the output of the Transform card.
The data type used for the output of the previous card is not a simple type. The simple types are string, number, integer, boolean, date, and dateTime.
The data type used for the output of the previous card was defined with a schema, not an example.