tSetGlobalVar
Facilitates the process of defining global variables.
tSetGlobalVar
allows you to define and set global variables in GUI.
tSetGlobalVar Standard properties
These properties are used to configure tSetGlobalVar running in the Standard Job framework.
The Standard
tSetGlobalVar component belongs to the Custom Code family.
The component in this framework is available in all Talend
products.
Basic settings
Variables |
This table contains two columns.
Key: Name of the variable to be
Value: Value assigned to this |
Advanced settings
tStatCatcher Statistics |
Select this check box to gather the Job processing metadata at a |
Global Variables
Global Variables |
ERROR_MESSAGE: the error message generated by the A Flow variable functions during the execution of a component while an After variable To fill up a field or expression with a variable, press Ctrl + For further information about variables, see |
Usage
Usage rule |
This component is generally used as a one-component subJob. |
Limitation |
Knowledge of Java language is required. |
Printing out the content of a global variable
This scenario is a simple Job that prints out the value of a global variable defined
in the tSetGlobalVar component.

Setting up the Job
- Drop the following components from the Palette onto the design workspace: tSetGlobalVar and tJava.
-
Connect the tSetGlobalVar component to the
tJava component using a Trigger > OnSubjobOk connection.
Configuring the tSetGlobalVar component
-
Double-click the tSetGlobalVar component to
display its Basic settings view. -
Click the plus button to add a line in the Variables table, and fill the Key and Value fields with
K1 and 20 respectively. -
Then double-click the tJava component to
display its Basic settings view. -
In the Code area, type in the following
lines:1234String foo = "bar";String K1;String Result = "The value is:";
12Result = Result + globalMap.get("K1");
123System.out.println(Result);
this use case, we use the Result variable. To access the
global variable list, press Ctrl + Space bar on
your keyboard and select the relevant global parameter.
Job execution
Save your Job and press F6 to execute it.
The content of global variable K1 is displayed on the
console.
