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

how to set context variables to see other context variables

Hi,

How can I set context variables to see other context variables?

I would like to do like below: 

  ID            Value

  parentID parentValue + context.childID

  childID    childValue

 

Im using Talend Open Studio for Data Integration.

Best regards.

Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

I'm afraid that is not possible. You will notice that the context window takes all values as literal values. For example, you do not need to surround Strings in quotes. You can only set literal values here. So trying to reference another context variable will simply be understood as setting the value to the name of the variable.

 

However, there is absolutely nothing wrong with using the tJava component to achieve what you want. Talend is a Java tool and you will notice that the design window simply enables Java code generation behind the scenes. If you want to achieve your requirement you can start your job with a tJava component and carry out the context manipulation there. You can do this anywhere in the job, but my assumption is that you want it done at the beginning because if it was possible to do this in the context window, it would be done at the beginning of the job.

View solution in original post

8 Replies
manodwhb
Champion II
Champion II

@coffeeno ,in a subjob you can sett contexts using tjava component

 

(String)globalMap.put("childID",childValue);

(String)globalMap.put("parentID",parentValue + context.childID);

Anonymous
Not applicable
Author

Thanks for your reply.

I would like to use global context , not globalMap in tJava.

Is this impossible ?

manodwhb
Champion II
Champion II

@coffeeno ,you can check with tContextLoad to load the contexts.

manodwhb
Champion II
Champion II

@coffeeno ,check the below example you can set.

 

0683p000009M2Fq.png

Java code:

context.childID="EDG";
context.parentID=context.childID+"DEF";
System.out.println(context.childID);
System.out.println(context.parentID);

0683p000009M2c1.png

Anonymous
Not applicable
Author

thanks for replies.

My question is how to set context variables to see other variables without using tJava.

 

Anonymous
Not applicable
Author

Context variables can see other context variables in the same job. They can also be passed between jobs. Can you elaborate on your question as @manodwhb has covered my interpretations of your question.

Anonymous
Not applicable
Author

Thanks.

>context.parentID=context.childID+"DEF";

I know by using tJava, i can set context variables to see other context variables.

 

But I would like to know ,in only within context window, how to set context variables to see other context variables.

because i suppose context variables within context window will be property-file after making batches,

which is i want to do.

 

Best regards.

 

 

Anonymous
Not applicable
Author

I'm afraid that is not possible. You will notice that the context window takes all values as literal values. For example, you do not need to surround Strings in quotes. You can only set literal values here. So trying to reference another context variable will simply be understood as setting the value to the name of the variable.

 

However, there is absolutely nothing wrong with using the tJava component to achieve what you want. Talend is a Java tool and you will notice that the design window simply enables Java code generation behind the scenes. If you want to achieve your requirement you can start your job with a tJava component and carry out the context manipulation there. You can do this anywhere in the job, but my assumption is that you want it done at the beginning because if it was possible to do this in the context window, it would be done at the beginning of the job.