One Star

Assigning context variables in tJavaRow

Hi I'm trying to assign context variables in a tJavaRow with a tMap output.
My job is like this:
(process)--------tMap---(out)---main---tJavaRow
In my tJavaRow:
context.C1=out.BUSINESS_ID;
context.C2=out.SOURCE;
context.C3=out.COUNTRY;
This returns "null". When I put a tLogRow after my tMap I see the data. I tried with a tJava in vain.
Any Idea?
Thanks
5 REPLIES
One Star

Re: Assigning context variables in tJavaRow

Don't think this is the right way to do it as the conntexts will only have the value of the last mapping. Also tLogRow won't print the context values.
One Star

Re: Assigning context variables in tJavaRow

Thanks Janhess
This is exactly I'm trying to do, having the value of the last mapping in my context variables. but it dosn't work.
One Star

Re: Assigning context variables in tJavaRow

Are you sure? in your tJavaRow put a println for the contexts to see the value.
One Star

Re: Assigning context variables in tJavaRow

janhess,
When in my tjavarow I do : System.out.println(context.C1) I have "null" in the console. I can't explain this
One Star

Re: Assigning context variables in tJavaRow

Ah I remember. You need to specify the input fields as
System.out.println(input_row.field name)
So in your case you would have
context.C1=input_row.BUSINESS_ID;
context.C2=input_row.SOURCE;
context.C3=input_row.COUNTRY;