tMap from two tSetGlobalVar

Highlighted
Four Stars

tMap from two tSetGlobalVar

I have two tSetGlobalVar in which I store two different columns. NB_DNCL_OLD and NB_DNCL_NEW.

I am trying to connect them to a tMap component in order to have a single table as output, adding an expression for the difference between both integer variables. I am able to connect NB_DNCL_OLD as row3 (Main) to tMap but I am not allowed to connect NB_DNCL_NEW to the same tMap.

Should I use any component between the tSetGlobalVar and the tMap? What am I doing wrong? (I am new to Talend and I have no Java knowledge).

I have just recreated the tsetglobalvar and I have connected them to the tMap without connecting them to their sources (2 tFlowIterate) and this time I was able to connect the second one to the tMap through a lookup but, if I try to reconnect the tsetglobalvars to their sources I have the same problem: I am able to connect just the first as Main and I am not allowed to connect the second. Thanks for your advice.

 

 


Accepted Solutions
Eight Stars

Re: tMap from two tSetGlobalVar

tSetGlobalVar puts the var into a map that you can use anywhere in your job, you dont need to connect that component to anything.  You just refer to the variable by the key using the following syntax (casting to a string in this case):

(String) globalMap.get("key")

Where "key" is the name of the key you set in your tSetGlobalVar component.

So if you want to use this value in your tMap, in the output column you would put the expression above


All Replies
Eight Stars

Re: tMap from two tSetGlobalVar

tSetGlobalVar puts the var into a map that you can use anywhere in your job, you dont need to connect that component to anything.  You just refer to the variable by the key using the following syntax (casting to a string in this case):

(String) globalMap.get("key")

Where "key" is the name of the key you set in your tSetGlobalVar component.

So if you want to use this value in your tMap, in the output column you would put the expression above

Four Stars

Re: tMap from two tSetGlobalVar

@evansdar Thank you for your answer! Smiley Happy

I have just erased the tMap and I am using my global variables and an expression to calculate the difference between them directly into the tSendMail component's message body. To have a little table with my current 3 variables I just set the MIME subtype to HTML and will insert the code.

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Downloads and Trials

Test drive Talend's enterprise products.

Downloads