One Star

global variables in java

Hello Smiley Happy
I have a perl job in which I use a tPerlRow composant in which I wrote :
$output_row = $input_row;
$output_row = $_globals{line};
$_globals{line} = $input_row;

Now I want to do the same job but in java... what should I put in my tJavaRow ? What is the equivalent of $_globals ?
Thank you Smiley Happy
Tags (1)
4 REPLIES
One Star

Re: global variables in java

Hi,
is globals the global map or a context variable?
In the first case:
output_row.line = input_row.line;
output_row.previous_line = (String)globalMap.get("line");
globalMap.set("line", input_row.line);

If it is a context variable (this would make more sense):
output_row.line = input_row.line;
output_row.previous_line = context.line;
context.line= input_row.line;

Bye
Volker
One Star

Re: global variables in java

Hello,
Actually I was using the job Plegall detailed in 5784
I think that it is a global map variable, but
globalMap.set("line", input_row.line);

won't work.
Error : "The method set(String, String) is undefined for the type Map<String,Object>"
Do you have an idea of what I could do to fix this ?
Thank you ! Smiley Happy
One Star

Re: global variables in java

Hi again !
OK, it's working, I just had to change the globalMap.set into a globalMap.put.
output_row.line = input_row.line;
output_row.previous_line = (String)globalMap.get("line");
globalMap.put("line", input_row.line);

Thanks again Volker ! Smiley Happy
One Star

Re: global variables in java

Yes,
you are right. Thanks for correction.
Bye
Volker