Skip to content

A mapping with a transformation expression

What this example shows

How transformation logic is recorded in a mapping - a target attribute built from more than one source attribute, with an expression describing how they combine.

It is the end state of Add Expressions to a Mapping.

Branch: examplesmappingwith-expression

What changed from the basic mapping

Everything in the basic mapping, plus one attribute:

- attribute: Name
  sources:
    - CustomerSource.FirstName
    - CustomerSource.LastName
  expression: "CONCAT_WS(' ', {{CustomerSource.FirstName}}, {{CustomerSource.LastName}})"

How an expression works

Three things are worth noticing:

sources still lists every attribute involved. Both FirstName and LastName are declared, not just referenced inside the expression string. That is what keeps lineage intact - CrossModel can still answer "what feeds Name?" without parsing SQL.

The expression uses {{…}} placeholders, not raw column names. The placeholder refers to the source object by its id, so the expression survives the underlying table or column being renamed, and the same expression works regardless of how the source is joined.

The expression is passed through, not interpreted. CONCAT_WS is a SQL function, and CrossModel does not evaluate it - it records it and hands it to code generation, where it lands in the generated SELECT. That means you can write any expression your target platform understands, but also that CrossModel cannot tell you whether it is valid for that platform.

What to look at

  • The expression editor. Open the Name attribute mapping and look at the Expression section in the properties panel. Source references render as chips, clipped from the left when they are long, each with a ⊗ to remove it.
  • The fx marker. On the mapping diagram, target attributes carrying an expression are marked with a small fx. It is the quickest way to spot where logic lives in a large mapping.

Where to go next