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

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

accessing globalMap inside a custom routine

A colleague of mine said that this was possible, by passing in the (entire) globalMap to the routine.
Does anyone know the best syntax to pass in, and receiving routine example to show how to get and put, once in the routine?
Thanks.
Labels (2)
1 Reply
Anonymous
Not applicable
Author

Hi
Yes, it is possible to pass the global variable globalMap to custom routine. For example:
Here is my custom routine,
public class myroutine {

public static void passGlobalVariableToRoutine(java.util.Map<String, Object> globalMap) {
globalMap.put("key", "shong");

}
}

code on tJava:
myroutine.passGlobalVariableToRoutine(globalMap);
String s=(String)globalMap.get("key");
System.out.println(s);

output on console:
Starting job test at 09:30 15/09/2011.
connecting to socket on port 3935
connected
shong
disconnected
Job test ended at 09:30 15/09/2011.

Best regards
Shong