Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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

 

Labels (4)
1 Solution

Accepted Solutions
manodwhb
Champion II
Champion II

@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

View solution in original post

3 Replies
manodwhb
Champion II
Champion II

@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

Anonymous
Not applicable
Author

It works, thank you 0683p000009MACn.png

manodwhb
Champion II
Champion II

You are welccoem!!,Kudos also accepted.