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

Announcements
Qlik and ServiceNow Partner to Bring Trusted Enterprise Context into AI-Powered Workflows. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

set the global context variable in job

Hi,
Is there a way to have a job to set the global context variable? I was able to set it only in the context of the job but I need it to apply for all jobs referencing it at runtime.
thanks
Labels (2)
5 Replies
Anonymous
Not applicable
Author

Hello
I was able to set it only in the context of the job but I need it to apply for all jobs referencing it at runtime.

In the first job, output the result(value of global variable) to a file.
At the beginning of other jobs, using tContextLoad to load the value of context from the file.
Best regards

shong
Anonymous
Not applicable
Author

Thanks Shong. I also tried using globalMap by setting key/value in the job and tried retrieve it in another, but evidently it is not 'global' across jobs.
Anonymous
Not applicable
Author

Hello
I also tried using globalMap by setting key/value in the job and tried retrieve it in another, but evidently it is not 'global' across jobs.

The globalMap variable is only avaiable within the current job, not for other jobs. As I said before, if you want to use a variable in other jobs at the runtime, you should output the value of variable to a file first, and then load the value at the begining of other jobs. eg:
tFixedFlowInpu---tFileOutputDelimited(output a new vlaue of variable to a file, for example, the result of file looks like: key;newValue)
|
onsubJobOK
|
tRunJob_1
|
onsubJobOK
|
tRunJob_2
in the begining of tRunJob_1 and tRunJob2, load the value of context vars
tFileInputDelimited---tContextLoad
|
other subJobs
Best regards

shong
Anonymous
Not applicable
Author

Thanks, it works well. Although I have more variables I need to write out. I ended up doing multiple tfixflowinput flows in order to populate the key/value columns properly. Is there a more elegant way to go about it? Some iteration of sorts?
Anonymous
Not applicable
Author

you can also use the tBufferOutput components to pass values back out of subjobs