I need help... please (Context param return null)

Highlighted
Six Stars

I need help... please (Context param return null)

 

 

hi all,

 

I have this job...

 

1.PNG

 

tFileInputDelimited is...

2.PNG

 

and, Param_CMD

3.PNG

4.PNG

 

 

tFlowTolterate

5.PNG

 

and call another job (MD_O_GCTR02HT_01)

Component...

6.PNG

 

and MD_O_GCTR02HT_01(Context)

7.PNG

 

tJAVA...

8.PNG

 

Debug JOB...

9.PNG

 

I NEED HELP PLEASE... THANKS...


Accepted Solutions
Moderator

Re: I need help... please (Context param return null)

@jklee88 ,check the below way. it is working ,check have you followed these steps.

 

Untitled.pngUntitled.pngUntitled.pngUntitled.pngUntitled.png

Manohar B
Don't forget to give kudos/accept the solution when a replay is helpful.

View solution in original post


All Replies
Highlighted
Community Manager

Re: I need help... please (Context param return null)

Hi
You can't get the value of global variables in Context views. If you want to specify value to context variable, do it on a tJava after tFlowToIterate. eg:
tFileInputDelimited--main--tFlowToterate--iterate--tJava--oncomponentok--tRunJob
on tJava:
context.p_DT_FR=(String)globalMap.get("row1.p_DT_FR")
....

Regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
Highlighted
Six Stars

Re: I need help... please (Context param return null)

Thank you for reply,

 

But, same error occured...Smiley Sad

1.PNG2.PNG

 

Thanks you...

Highlighted
Moderator

Re: I need help... please (Context param return null)

@jklee88 , in your sub job , you need to connect by trigger>>on component ok option from the tDBrow to tJava .

 

Manohar B
Don't forget to give kudos/accept the solution when a replay is helpful.
Highlighted
Community Manager

Re: I need help... please (Context param return null)

the context variables defined in the child job have been assigned values on tRunjob, just print the value on tJava to check if the values are passed correclty, eg:
in the child job:
tJava--oncomponentok--tDBRow_1

on tjava:
System.out.println(context.p_DT_FR);

----------------------------------------------------------
Talend | Data Agility for Modern Business
Highlighted
Six Stars

Re: I need help... please (Context param return null)

@manodwhb , component ok change main ...

 

it is same result...Smiley Sad

Highlighted
Six Stars

Re: I need help... please (Context param return null)

@shong , child job contexts...and parent job component, and tJAVA

 

1.PNG2.PNG3.PNG

 

The results are the same...

In debug, parameters appear, and when run, parameters appear NULL...

Highlighted
Community Manager

Re: I need help... please (Context param return null)

You have defined context variables in child job, and use these variables in any where. Don't need to define the global variables again. Print the value of context variable.
on tjava:
System.out.println(context.p_DT_FR);
----------------------------------------------------------
Talend | Data Agility for Modern Business
Highlighted
Six Stars

Re: I need help... please (Context param return null)

@shong  , thanks for your reply....

 

tJAVA ...

1.PNG

 

Still Parameter value is null...Smiley Sad

 

The same result is if delete and create a new job. Why continue to return null?

 

 

Highlighted
Community Manager

Re: I need help... please (Context param return null)

Can you change the code of tJava to:
System.out.println(context.p_DT_FR);
----------------------------------------------------------
Talend | Data Agility for Modern Business
Highlighted
Six Stars

Re: I need help... please (Context param return null)

Still same...Smiley Sad

 

1.PNG

Highlighted
Community Manager

Re: I need help... please (Context param return null)

would you mind exporting your job and send it to me via email? I will take a look at them on my studio.
shong@talend.com

Regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
Moderator

Re: I need help... please (Context param return null)

@jklee88 ,check the below way. it is working ,check have you followed these steps.

 

Untitled.pngUntitled.pngUntitled.pngUntitled.pngUntitled.png

Manohar B
Don't forget to give kudos/accept the solution when a replay is helpful.

View solution in original post

2019 GARTNER 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

Best Practices for Using Context Variables with Talend – Part 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog