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

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Set Variables in tSetGlobalVar

How to set a long, float or double variable in tSetGlobalVar?
How to access a long, float or double variable in tSetGlobalVar by using globalMap.get() or globalMap.put() function?
Labels (2)
4 Replies
Anonymous
Not applicable
Author

Anonymous
Not applicable
Author

Thanks for your reply.
look at a related forum:, but, it didn't answer my question.
I know I can set string and integer global variables in tSetGlobalVar and access these variables with GlobalMap.get():
(String)globalMap.get("myKey")    //the data type of value is String
(Integer)globalMap.get("myKey")   //the data type of value is Integer/int
Can I set long, float or double global variable in tSetGlobalVar or not. 
Can I do (Long)GlobalMap.get("MyKey") or not.
Anonymous
Not applicable
Author

hi,
globalMap store java Object , so you can store anything as all is object in java.(String, List, Long,etc )
It's also the reason why you have to cast your value from Object to a java type & be able to use methods & functions from that type.
regards
laurent
Anonymous
Not applicable
Author

Thanks, Zone. 
In tSetGlobalVar, when I add global variable, I cannot specify the variable type.
For example, I add a variable as "myVariable", and set the value as 0.00. I assume it is a Long variable. Than, I use (Long)GlobalMap.get("myVariable") to access this variable. I cannot get the value and the process is canceled.