Databases Reference
In-Depth Information
The
Expression Builder
is a really useful tool that allows you to
build data transformations in Java code from a library of functions
and expressions. You can also type Java code into the
Expression
Builder,
if there is a Java function you want to use that is not in the
function library. You'll find that you use the
Expression Builder
a lot,
particularly with complex integration transformations, so take some
time to practice with it. If your Java coding is a little rusty, simply
Google what you want to do. There is a wealth of Java tutorials and
code snippets on the Internet.
We're going to build an expression that joins the first and last names so that we can
pass the output to the
name
field in the output schema. To do this, double-click on
row1.FirstName
. This will then appear in the
Expression
window:
Place your cursor at the end of the expression, and then double-click on
row1.
LastName
. It will appear at your cursor position, which is after
row1.FirstName
.
The expression must be valid Java syntax, so we need to do a bit more work before
we can test the job again. Between
row1.FirstName
and
row1.LastName
type a
+
,
which is the Java string concatenation operator. The
Expression
window should
now show the following:
row1.FirstName+row1.LastName
Click on
OK
in the
Expression Builder
, and then click on
OK
again on the mapping
window. Let's see what happened, by running our job again.
Search WWH ::
Custom Search