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

Assign Value from tStatLogCatcher to a context variable

Hi,

 

I am trying to read some data from tStatLogCatcher like pid, system_pid and assign it to a context variable. My variable is context.pid and it is of String type. I have a job as shown in the picture below:

 

0683p000009Lzi8.pngI run the job, but no value is printed. Am I doing something wrong? Is this a right way to assign value to a context variable?

 

Thank you in advance!

Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Yes, I assing in tJava component this value: context.pid = pid. This way I have been able to store pid in my context variable.

View solution in original post

9 Replies
fdenis
Master
Master

context is like function parameter. you may use globalMap.put("pid") globalMap.get("pid")

Anonymous
Not applicable
Author

Could you give me an example of how to retrieve pid by using "globalMap.put("pid")" and where?. I do not know how to do it.

fdenis
Master
Master

if tlog did not give you the information you need…
there is no universal method to get pid…
why did you need it?
Anonymous
Not applicable
Author

What I need to do is to store pid in a variable and then use it in a stored procedure. I need pid because I want to store the processID of the current jobSession. So, i want to store it somewhere.


@fdenis wrote:
if tlog did not give you the information you need…
there is no universal method to get pid…
why did you need it?


 

fdenis
Master
Master

pid is an os level. if you run a task you can get the pid of the task.
to get pid from the process you have to ask your parent to guive your pid. how to ask pid depend on parent….
fdenis
Master
Master


Thanks to @Rall_2_0

If you add a tJava in a simple job with the following code....
System.out.println(pid);
System.out.println(fatherPid);
System.out.println(rootPid);

so you can retieve Pid using "pid" in a tmap output value.

fdenis
Master
Master

did you success on your task?
Anonymous
Not applicable
Author

Yes, I assing in tJava component this value: context.pid = pid. This way I have been able to store pid in my context variable.

fdenis
Master
Master

great!, so can you tag as solved?
see you next time!