Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

globalMap.put() not working in tJavaRow

Hi,

I try to change a globalMap variable in tJavaRow at every row (with a test).

but my problem is that it doesn't change anything when I use globalMap.put("CPBox",input_row.CPBox)...

I'm beginner and i think i don't use tSetGlobalVar in the right place...

Here is my job :

0683p000009Lxet.png

 

In my .csv, the output "CpBox" is the default variable "myValue" of the tSetGlobalVar... 

Someone can help me ? ^^

 

Thank you !

Labels (3)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

In your tJavaRow you are creating a new HashMap called "globalMapp". You do not need to create the "globalMap" HashMap, it is created by Talend for you. It also only has one "p".

 

In your tMap you are using the correct globalMap. However this will have no data since you were adding it to the one you created.

View solution in original post

7 Replies
TRF
Champion II
Champion II

As tSetGlobalVar starts first, you need to put your tJavaRow in a previous subjob

Anonymous
Not applicable
Author

@TRF, i think I understand what you mean, but I don't see how to realize it...

TRF
Champion II
Champion II

Well, maybe was not a so good idea.

What do you do in your tMap?

Anonymous
Not applicable
Author

@TRF,

I make this :

0683p000009Lxf3.png

Here is the version simplify for test, I actually get one address per customer, and a customer can have multiple delivery addresses (depending on where the warehouse is located), but the billing address is the same each time. And it changes for each client. So I want to define the billing address as soon as CLCCLL == 0 in global variable to have access to this address for all customer records.
Because CLCCLL was 0 for the parent company, 1 for the first warehouse, 2 for the second,etc...

and CLCCLL was reset for the second customer,etc...
I don't know if I'm clear, I myself had a little trouble understanding... 

Anonymous
Not applicable
Author

In your tJavaRow you are creating a new HashMap called "globalMapp". You do not need to create the "globalMap" HashMap, it is created by Talend for you. It also only has one "p".

 

In your tMap you are using the correct globalMap. However this will have no data since you were adding it to the one you created.

Anonymous
Not applicable
Author

@rhall, ok thanks, and how can i have data in the globalMap ? How can i put the data in the globalMap and use in tMap after ? ^^

Anonymous
Not applicable
Author

It's work !

Finally I removed the HashMap statement, and instead of charAt(0), I put charAt(1) (java array don't start at 0?).
I finally got the result I wanted, thank you both for taking your time!