User GuideReference ManualIntegration Scenarios
 

2.3.4. Format Function

See: Managing Channels - Message Transformation Functions

For each mapping, you can define a Format expression that will be applied on the mapped value.

The Format column appears next to the If and the Filter columns in the Transformation rules pane.

You can add a Format function as an Xpath expression to any mapping rule to easily and quickly format the output of this mapping rule. You can even use Format on a loop mapping to perform an action, like sorting, on the loop elements.

  • The Format function is equivalent to the format functions available in the Drag and Drop Transformation Functions but it is lighter and easier to use to format output data.

  • The Format expression is an Xpath expression, and the current mapped value is referenced by $value.

Format examples

In the following example, a data formatting is done on a numeric value and on a string..

Input csv file:

Code, Quantity, Price
A23, 2, 12.5
A24, 3, 10.0
A25, 1, 15.2
A26, 2, 13.6
Format example

Figure 2.49. Format example


The Price value is a number and is formatted using the ' format-number($value,'000.00') ' Xpath command in order to generate all this column values with the same format (three digits before the decimal dot with leading zeros if required, and two digits after).

The Code strings are formatted using the ' translate($value,'A','a') ' Xpath command in order to replace all capital 'A' with lower case 'a'.

The output file after mapping and formatting the input file is:

Code,Quantity,Price
a23,2,012.50
a24,3,010.00
a25,1,015.20
a26,2,013.60