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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to set variable in Route and pass it into cTalendJob in contxtPara

How I can ascribe " exchange.getIn().getMessageId()" to variable and pass it through "ContextParam" in cTalendJob to my Job?  I can pass String like "bla bla bla", but when I try pass variable like ${myVariable}, #{myVariable}, {myVariable}, $myVariable, context.myVariable I get error "myVariable cannot be resolved a variable". Someone knows how to do it?

0683p000009MDY3.png 0683p000009MDlu.png
  
Labels (2)
5 Replies
Anonymous
Not applicable
Author

Czesc 0683p000009MA9p.png
if you want to access a contextvariable you need to have it in the context of Job testowyroute already.
better use the globalMap:
in cProcessor1 write : globalMap.put("messid", ......);
in cTalendJob at column wartosci you write: (typeofmessagid)globalMap.get("messid")
HTH
dj
Anonymous
Not applicable
Author

Thx for replay.
I added cProcessor before cTalendJob with this:
import java.util.Map;
Map globalMap = new HashMap();
globalMap.put("messId", "testId");
and in cTalendJob in Context Param this:
(String) globalMap.get("messId")
but I get error "globalMap cannot be resolved". 
Anonymous
Not applicable
Author

???
globalMap is a standard Map in the TOS/TIS jobs, no need to declare it.
maybe the ESB architecture/codegeneration differs from TOS.
Sorry, cant help you then
Anonymous
Not applicable
Author

It's much easier than you think. The id is already part of the message. You don't need to change the route at all, instead in your job the first component should be a tRouteInput component. The schema of that component will be by default:
 body -> "${in.body}"
 Edit the schema and add a new column of type string: 
messageId -> "${id}"
Then simply assign it to whatever variable you wish from the flow. 
Loko
Creator II
Creator II

???
globalMap is a standard Map in the TOS/TIS jobs, no need to declare it.
maybe the ESB architecture/codegeneration differs from TOS.
Sorry, cant help you then

yes for jobs, but it does not exist in routes.