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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Darmesh
Contributor III
Contributor III

how to save a value from table to context variable

Hi,

 

I have a value in my table as 

 

name

xyz

 

how to store the value xyz to context variable. so that we can use it for further use.

Labels (2)
1 Solution

Accepted Solutions
aashish_21nov
Creator
Creator

use below code in tJavarow:

 

context.var = context.var+row4.newColumn ;

View solution in original post

9 Replies
manodwhb
Champion II
Champion II

@Darmesh,you can load to context using tContextLoad and check the below link to more about tContextLoad.

https://help.talend.com/reader/wDRBNUuxk629sNcI0dNYaA/xH2TyYr_AmQnKwOYlqVCvA

aashish_21nov
Creator
Creator

With the help of tjavarow component, you can do so.

So, your job would be like :

tmssqlinput-->tjavarow

In tjavarow write below code.

 

context.var = input_row.name;

 

Darmesh
Contributor III
Contributor III
Author

@aashish

first i have created context variable as var and did not enter anything in value column.

But it is not loading anything.0683p000009LyJI.png0683p000009Ly7i.png

aashish_21nov
Creator
Creator

@Darmesh you should write input_row.column_name rather than row4.column_name.

Darmesh
Contributor III
Contributor III
Author

@aashish

still i am getting null value.

 

0683p000009LyOD.png0683p000009Ly03.png0683p000009LyOI.png

aashish_21nov
Creator
Creator

System.out.println(context.var);

TRF
Champion II
Champion II

Setting a value to a context variable will not change what you can see into the Context tab, it changes only the current value for the runing job.

Darmesh
Contributor III
Contributor III
Author

@aashish @TRF

I got the result. But when i am passing that context var vaule to tmap. i am getting only "Quarterly Estimates" and not the variable value.

 

0683p000009LyON.png

aashish_21nov
Creator
Creator

use below code in tJavarow:

 

context.var = context.var+row4.newColumn ;