Skip to content

Add expressions to a mapping

Learn how to extend a mapping with logic by using expressions

Now that we have created a basic mapping in the previous tutorial, we'll explore how to use expressions to model business logic.

Create a simple expression

We'll use the mapping from the previous tutorial and extend it with an expression on the name field. Open the mapping canvas and notice that we have created two mappings on the Name field of the target Customer entity.

mapping-with-attribute-mappings

Now make sure the toolbox action Select is active and click on the Name field in the target Customer entity. Now open the properties panel on the right (tip: you can close the explorer panel on the left to keep more room for the mapping canvas).

attribute-mapping-detauls

Expand the expression panel and type the following expression. Notice that when you type {{ you can select any of the source attributes that are mapped to the target attribute.

CONCAT_WS(' ',{{CustomerSourceObject.FirstName}},{{CustomerSourceObject.LastName}})

attribute-mapping-with-expression

Note :

when referencing source attributes in an expression, make sure to enclose them in double brackets so CrossModel can evaluate them properly.

Notice that both input fields are set under sources in the property panel. Also notice that in the mapping canvas, target attributes that are mapped with an expression are marked with fx

In the next tutorial we'll see how to add multiple source objects to a mapping, making it possible to model mappings that contain integration logic.