
Anonymous
Not applicable
2011-08-04
11:51 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
[resolved] t_Java and setting a global variable
I was wondering if anyone could help me figure out why this code does not work (it executes just does not do what I want it to).
I have a tMap that sends one row to a tJava transformation. The t_Java is designed to set a global variable with the following code:
System.out.println("Value Of Input:" + setVariable.varTOP);
globalMap.put("context.rowTOP", setVariable.varTOP);
System.out.println("Value Of Input:" + setVariable.varTOP);
System.out.println("Value of Global Var: "+(Integer) globalMap.get("context.rowTOP"));
I have added the println for validation. No matter what I send as input from the tMap to the tJava equation it results in 0 being displayed by all of the println's above. I have tried to manually set the value in my tMap as 1 and it still displays 0 in the tJava. I am on talend 4.2.2.
Anyone have any ideas?
Thanks
I have a tMap that sends one row to a tJava transformation. The t_Java is designed to set a global variable with the following code:
System.out.println("Value Of Input:" + setVariable.varTOP);
globalMap.put("context.rowTOP", setVariable.varTOP);
System.out.println("Value Of Input:" + setVariable.varTOP);
System.out.println("Value of Global Var: "+(Integer) globalMap.get("context.rowTOP"));
I have added the println for validation. No matter what I send as input from the tMap to the tJava equation it results in 0 being displayed by all of the println's above. I have tried to manually set the value in my tMap as 1 and it still displays 0 in the tJava. I am on talend 4.2.2.
Anyone have any ideas?
Thanks
795 Views
1 Solution
Accepted Solutions

Anonymous
Not applicable
2011-08-04
12:03 PM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi ricepato
Connect a tjavarow to your tmap instead of a tjava.
tmap --main--> tjavarow
and using the following code in the tjavarow:
Connect a tjavarow to your tmap instead of a tjava.
tmap --main--> tjavarow
and using the following code in the tjavarow:
System.out.println("Value Of Input: "+input_row.varTOP);
globalMap.put("varTOP", input_row.varTOP);
System.out.println("Value Of GlobalVar: "+globalMap.get("varTOP"));
795 Views
2 Replies

Anonymous
Not applicable
2011-08-04
12:03 PM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi ricepato
Connect a tjavarow to your tmap instead of a tjava.
tmap --main--> tjavarow
and using the following code in the tjavarow:
Connect a tjavarow to your tmap instead of a tjava.
tmap --main--> tjavarow
and using the following code in the tjavarow:
System.out.println("Value Of Input: "+input_row.varTOP);
globalMap.put("varTOP", input_row.varTOP);
System.out.println("Value Of GlobalVar: "+globalMap.get("varTOP"));
796 Views

Anonymous
Not applicable
2011-08-04
01:06 PM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, just figured that out actually. Thanks for the response though!
795 Views
