Context Variable to tMap in Talend OS
Table of contents
No headings in the article.
I have encountered a use case, in which I do not have any input rows and need to
read the value of a context variable
then apply some Java code to that value
and produce output to tMap component.
I have followed the following steps to do so.
Create a new Job in Talend and add a tJavaFlex component to it.
In the tJavaFlex component, use the
context.your_variable_name
to load the context variable.Write your Java code in the 'Main Code' section of the tJavaFlex component.
Use the
globalMap.put("output_variable_name",your_value)
method to store the output data in the globalMap.Connect the tJavaFlex component to the tMap component using a Row > Main connection.
In tMap component, use the
((String)globalMap.get("output_variable_name"))
to get the data from the globalMapRun the job and check the results.
Note: Make sure that your context variable is defined and has a value before running the job.
Happy Learning !