Skip to main content

Command Palette

Search for a command to run...

Context Variable to tMap in Talend OS

Published
1 min read
R

As a Senior Software Engineer, I specialize in designing and developing scalable and efficient backend systems using technologies such as Java, Spring Boot, Docker, ELK Stack, and Talend ETL. I am passionate about tackling complex challenges and pride myself on taking ownership of projects from start to finish. In addition to my technical skills, I am also a strong communicator and enjoy mentoring and motivating others to reach their full potential.

  • I don't stop when I am tired, I stop when I'm done.

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.

  1. Create a new Job in Talend and add a tJavaFlex component to it.

  2. In the tJavaFlex component, use the context.your_variable_name to load the context variable.

  3. Write your Java code in the 'Main Code' section of the tJavaFlex component.

  4. Use the globalMap.put("output_variable_name",your_value) method to store the output data in the globalMap.

  5. Connect the tJavaFlex component to the tMap component using a Row > Main connection.

  6. In tMap component, use the ((String)globalMap.get("output_variable_name")) to get the data from the globalMap

  7. Run 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 !

More from this blog

Rao Waqas Akram

23 posts