Null value when reading from mysql

Four Stars

Null value when reading from mysql

Hi all,

 

I want to assign a single value from mysql to a context variable using the following job:

 

tMysqlinput --> max_finding1(main) --> tJava (a screenshot is also attached)

 

tMysqlinput  returns only one value:

"select max(id) as mysql_finding_id from finding;"

 

 tJava :

System.out.println(max_finding1.mysql_finding_id);
context.db_id=max_finding1.mysql_finding_id;

 

but I'm getting a null value as a result. while printing the result to a log, I can see the corrected value.

 

Do someone knows why I get null?

 

Thanks

 


Accepted Solutions
Thirteen Stars

Re: Null value when reading from mysql

@Emmaber,you need to re-design a job that  below way.

 

tMysqlinput-->tSetGlobalvar

-->on Subjob then put tJava and pint the global variable value.

 

to know more about tSetGlobalvar use below link.

https://help.talend.com/reader/WWQ40R_iTE5~~9VkUQrjgQ/xx0nz4uGJnqyc7dKOLN4Wg

Manohar B

All Replies
Thirteen Stars

Re: Null value when reading from mysql

@Emmaber,you need to re-design a job that  below way.

 

tMysqlinput-->tSetGlobalvar

-->on Subjob then put tJava and pint the global variable value.

 

to know more about tSetGlobalvar use below link.

https://help.talend.com/reader/WWQ40R_iTE5~~9VkUQrjgQ/xx0nz4uGJnqyc7dKOLN4Wg

Manohar B
Four Stars

Re: Null value when reading from mysql

It works, thank you Smiley Happy

Thirteen Stars

Re: Null value when reading from mysql

You are welccoem!!,Kudos also accepted.

Manohar B

Tutorial

Introduction to Talend Open Studio for Data Integration.

Definitive Guide to Data Integration

Practical steps to developing your data integration strategy.

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.