Liquid XML Studio
See Also Send Feedback
Data Mapping > Data Mapper Functions > By Category > String > Concat

Glossary Item Box

Function Name
Concatenate two or more input Strings
String 1 First String to concatenate
String 2 Second String to concatenate
... More inputs can be added see Variable Function Inputs
Result Text String comprising input Strings concatenated
None -


The Data Mapper String Concat function concatenates two input Strings. If you need to combine two items from your source XML into a single item in the target, you can use the Concat function. When mapping XML data, it is common to find that your source and target Schemas use differing numbers of elements and attributes -concatenation is therefore common. By default, the Concat function appears with two inputs, however, you can add and remove inputs by right-clicking them within the mapper if you need to alter the range of values you are concatenating. To apply the String Concat function, use the following process:

Create a new Data Mapper file, dragging your XML data source and targets into the editor area. For this example we are using office_alt_source.xsd, an XML Schema Definition inferred from the following source:

Source XML Copy Code
 <file type="corporate">
  <title>Smith and Mitchell</title>
 <file type="individual">
  <title>James Black</title>

For our target schema we will be using office_target.xsd, inferred from the following XML:

Target XML Copy Code
 <account reference="98765hijkl">
  <contact>Jane Johnson</contact>
 <account reference="56789rstuv">
  <contact>Mary Simpson</contact>

The data models office files for an organisation. Here is the Data Mapper with Source and Target imported:

String Concat Reader and Writer

Let's assume that we want to combine the "num" and "code" elements in the source, mapping these two concatenated to the "reference" attribute in the target. Drag the String Concat function from the Component Palette into the mapping area:

String Concat Component

String Concat Transform Added

The String Concat function takes two (or optionally more) inputs and gives a String output. The String 1 input should be connected to the input String you want to use as the first part of the new String. The String 2 input should be connected to the String you want to use as a the second part of the result String, and so on. The output should be connected to the target item, which may be in the XML Writer or another mapping component if you need to apply further transformations. Connect the String 1 String input to the "num" output in the XML Reader, and the String 2 input to the "code" item. Connect the Concat output to the "reference" input in the XML Writer.

String Concat Transform Mapped

Finally let's connect the remaining input and output connections:

Input and Output Connections Mapped

We can now execute the transform by pressing Shift-F5 or the Execute button (Execute). The transform is applied and the file we selected as output opens in the editor:

Output XML Copy Code
 <account reference="12345abcde">
  <contact>Smith and Mitchell</contact>
 <account reference="54321fghij">
  <contact>James Black</contact>

The input Strings have been combined as part of the mapping process. You can also use Concat to add additional characters to Strings by applying the Concat function to an input String and a Constant representing the characters you wish to add. If you need to concatenate multiple instances of input values, try the ConcatAll function.

You can add and remove inputs from the Concat function. Right-click an existing input in the Mapper and choose Add Below, Add Above or Delete.

This is a scalar function so the standard rules apply if multiple values are presented to one or more inputs.

See Also