globalMap and child job

One Star

globalMap and child job

Hello,
I need to transfer a list of job value of a father to a child job.
I read the topic 'http://www.talendforge.org/forum/viewtopic.php?id=9342' but it does not work.
For testing I created a father job: tJava -> tRunJob. TJava contains "globalMap.put ("String","A")"
The child job: tJava with "System.out.println ("Sous job = " (String)globalMap.get("String"))"
When I run the father job it is displayed in the console the following message:
Démarrage du job a a 17:34 22/08/2013.
connecting to socket on port 4025
connected
Sous job = null
disconnected
Job a terminé à 17:34 22/08/2013.
Thank you for your help
TOS Data Integration 5.2.1
Five Stars

Re: globalMap and child job

The child Job has no visibility of the parent's globalMap.
The easiest thing for you to do is to create a context variable in your child job and then pass the value.
You can pass the value through tRunJob->Basic settings
E.g.
Parameter Value
myString (String) globalMap.get("String")
And then, in your child Job
System.out.println ("Sous job = " + context.myString)
Moderator

Re: globalMap and child job

Hi,
Please read KB article about TalendHelpCenterSmiley Tongueassing a value from a parent Job to a child Job.
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: globalMap and child job

Thank for your quickly reply.
I test your solution xdshi.
But Shong