javavariablesexpressiontalendtmap

How to apply a tmap variable to multiple output fields in Talend?


I'm working with tmap and I was wondering if it's possible to use this simple use case:

I create a variable in central tmap section, and I apply the same variable to multiple output fields.

enter image description here

In the above example, I have two String fields and I want to convert them to Upper case. Is it possible, via the use Variables, to write the function once and then call it in every output fields I want?

Cause otherwise the only way to do that is to re-write the function StringHandling.UPCASE( ) in every field in the output table.

I've tried to use the following syntax, but didn't work. Also in the talend community or forums online I didn't find a solution, maybe because there isn't any?

[![enter image description here](https://i.sstatic.net/xIPQ9.png)](https://i.sstatic.net/xIPQ9.png)


Solution

  • Hi instead of having to rewrite the code in every field there is a functionnality in the tMap component that allows you to apply a routine or functions to the fields that you selected, you just have to select the field you want the function to be applied and then right click and you have the option to "apply routine" it looks like this

    enter image description here

    And it applies the function / routine to the field you selected automaticaly.

    It works with talend standard routines but also with the custom routines you write

    enter image description here