Using intermediate variables in tMap
The tMap
component is the most flexible and most used component in Talend, despite having the limitation on multiple lines for an expression. In the previous recipe, we saw how ternary expressions can be used to extend the capability of the tMap
expressions. In this recipe, we will see that the tMap
variables can also extend the capability of tMap.
Getting ready
Open the job jo_cook_ch04_0040_tMapVariables
.
How to do it…
In the Var section, click + to add a new variable, set the name to
paymentTotal
and Type tofloat
, as shown in the following screenshot:Insert the following code into the expression field:
customer.payment1+customer.payment2+customer.payment3+customer.payment4+customer.payment5+customer.payment6
Repeat step 1 for a variable named
averageLastSixMonths
with Type set tofloat
, and a variable namedaverageAnnual
also with Type set tofloat
.Select
paymentTotalRow
by clicking the left mouse button.Drag the
paymentTotalRow
variable into the Expression...