Setting expressions for multiple output columns simultaneously - 7.1

Talend Data Management Platform Studio User Guide

author
Talend Documentation Team
EnrichVersion
7.1
EnrichProdName
Talend Data Management Platform
task
Design and Development
EnrichPlatform
Talend Studio

About this task

tMap allows you to define the transformation behavior for multiple output columns at the same time.

Using a simple transformation Job, the following example shows how to define expressions on multiple columns in a batch manner in tMap.

Here is the content of the input CSV file used in this example:

id;firstname;lastname;city;state
1; Andrew;Adams;Madison; Rhode Island
2;Andrew; Garfield; Saint Paul;Colorado
3; Woodrow;   Eisenhower    ; Juneau; New Hampshire
4;Woodrow; Jackson;Denver;Maine
5; Lyndon;Buchanan; Pierre; Kentucky
6;  Bill;Tyler; Helena; New York
7;George;Adams;Oklahoma City    ;Alaska
8;Ulysses; Garfield;Santa Fe;Massachusetts
9; Thomas;Coolidge  ;Charleston;   Mississippi
10;John;Polk;   Carson City;  Louisiana

In this example, all the output columns of type String will be trimmed to remove preceding and training whitespace and the last names and state names will be transformed to upper case.

Procedure

  1. In the Map Editor, complete the input-output mappings.
  2. Select the columns of type String in the output table, namely firstname, lastname, city, and state in this example, and right-click the selection so that the Apply Routine button shows up.
  3. Click the Apply Routine button to open the Expression Builder dialog box.
  4. Select StringHandling in the Categories area, and then double-click the TRIM function in the Functions area to get StringHandling.TRIM(${0}) in the Expression field.
  5. Click OK to close the Expression Builder dialog box.
  6. Select the lastname and state columns in the output table of the Map Editor, right-click the selection, and then click the Apply Routine button to open the Expression Builder dialog box.
  7. Select StringHandling in the Categories area, and then double-click the UPPERCASE function in the Functions area to get StringHandling(${0}) in the Expression field.
  8. Click OK to close the Expression Builder dialog box.

Results

Now the expressions on those output columns look like below:

The functions will be carried out along the flow processing. The output of this example is as shown below.