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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to override context variable?

Hi,

 

I want to change the value of a context variable and save it permanently in a context file.

 

Here is what I tried already : 

0683p000009Lx0e.png0683p000009Lwjp.png

 

The System.out.println() gives me a "b", but when I go into the file written by the tContextDump component it still prints an "a" :

 

0683p000009Lwol.png

 

Thanks for the help.

Labels (2)
1 Solution

Accepted Solutions
TRF
Champion II
Champion II

Hi,

You need to use tContextLoad to update your context, so you need to follow this design:

0683p000009Lwec.png

As you see the context contains 3 variables. tLogRow_45 gives the initial values for them.

In tJavaRow, I set the value of the "sample" variable like this before to use tContextLoad:

output_row.key = input_row.key;
if(input_row.key.equals("sample"))
  output_row.value = "100";
else
  output_row.value = input_row.value;

Then the next tContextDump gives me the expected result as you can see.

That's for the principle, maybe there is other approach to do that.

 

View solution in original post

3 Replies
TRF
Champion II
Champion II

Hi,

You need to use tContextLoad to update your context, so you need to follow this design:

0683p000009Lwec.png

As you see the context contains 3 variables. tLogRow_45 gives the initial values for them.

In tJavaRow, I set the value of the "sample" variable like this before to use tContextLoad:

output_row.key = input_row.key;
if(input_row.key.equals("sample"))
  output_row.value = "100";
else
  output_row.value = input_row.value;

Then the next tContextDump gives me the expected result as you can see.

That's for the principle, maybe there is other approach to do that.

 

Anonymous
Not applicable
Author

Thank you
TRF
Champion II
Champion II

You're welcome