Skip to main content Skip to complementary content

Setting expressions for multiple output columns simultaneously

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.

Example of a Job using the tFileInputDelimited, tMap, and tLogRow components.

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.
    Map editor.
  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.
    Apply Routine button from the Map editor.
  3. Click the Apply Routine button to open the Expression Builder dialog box.
    Overview of 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.
    Expression field in the Expression Builder dialog box.
  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.
    Expression field in the Expression Builder dialog box.
  8. Click OK to close the Expression Builder dialog box.

Results

Now the expressions on those output columns look like below:

Output section from the Map editor.
The functions will be carried out along the flow processing. The output of this example is as shown below.
Example of some results.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!