Set Variables in tSetGlobalVar

One Star

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?
Moderator

Re: Set Variables in tSetGlobalVar

Hi,
Please have a look at a related forum:http://www.talendforge.org/forum/viewtopic.php?id=15888
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: Set Variables in tSetGlobalVar

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.
Seventeen Stars

Re: Set Variables in tSetGlobalVar

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
One Star

Re: Set Variables in tSetGlobalVar

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.