One Star

Use a parameter as jobname in a tRunJob component

Is it possible to use a global variable or a context variable as jobname in a tRunJob component?
If yes, how?
What I want to do is to have a list of jobs in a file and to execute them sequentially.
Thanks
Didier
8 REPLIES
Moderator

Re: Use a parameter as jobname in a tRunJob component

Hi Didier,
"Use dynamic job " option allow multiple Jobs to be called and processed.
Please refer to the scenario "Running a list of child Jobs dynamically" from component reference:TalendHelpCenter:tRunJob
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: Use a parameter as jobname in a tRunJob component

Thanks Sabrina,
So I have looked the help page and modified my job



but currently I have the following erreor:
Démarrage du job PMI_Schedule a 10:52 21/01/2016.
connecting to socket on port 3630
connected
Exception in component tFlowToIterate_1
job1|Q
job2|M
java.lang.NullPointerException
    at pmi.pmi_schedule_0_1.PMI_Schedule.tFileInputExcel_1Process(PMI_Schedule.java:1495)
    at pmi.pmi_schedule_0_1.PMI_Schedule.runJobInTOS(PMI_Schedule.java:2196)
    at pmi.pmi_schedule_0_1.PMI_Schedule.main(PMI_Schedule.java:2024)
disconnected
Job PMI_Schedule terminé à 10:52 21/01/2016.

why?
As you can see I can displyed the data:
job1|Q
job2|M
Where is the problem?
Thanks
Didier
Moderator

Re: Use a parameter as jobname in a tRunJob component

Hi,
You are using "If" connection type between tflowtoiterate and tRunjob. What's the condition?
It seems that ((String)globalMap.get("log.Nom_du_job")) doesn't receive any value.
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: Use a parameter as jobname in a tRunJob component

below the condition:
(String)globalMap.get("frequence").equals("Q")||((String)globalMap.get("frequence").equals("M")&&TalendDate.getFirstDayOfMonth(TalendDate.getCurrentDate())==TalendDate.getCurrentDate())
Moderator

Re: Use a parameter as jobname in a tRunJob component

Hi,
Have you tried to use "iterate" row without this condition to see if your job works?
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: Use a parameter as jobname in a tRunJob component

with iterate:
Démarrage du job PMI_Schedule a 11:37 21/01/2016.
connecting to socket on port 3612
connected
Exception in component tRunJob_2
java.lang.RuntimeException: The child job named null is not in the job list.
    at pmi.pmi_schedule_0_1.PMI_Schedule.tFileInputExcel_1Process(PMI_Schedule.java:1617)
    at pmi.pmi_schedule_0_1.PMI_Schedule.runJobInTOS(PMI_Schedule.java:2230)
    at pmi.pmi_schedule_0_1.PMI_Schedule.main(PMI_Schedule.java:2058)
disconnected
Job PMI_Schedule terminé à 11:38 21/01/2016.

One Star

Re: Use a parameter as jobname in a tRunJob component

below the screenshot of the debug session:

One Star

Re: Use a parameter as jobname in a tRunJob component

I have done many tests and it does not work
I think that my ((String)globalMap.get("Nom_du_job")) is empty in the tRunJob component:


the global variable Nom_du_job should be defined in the tFlowToIterate component ???
Could you tell me where I am wrong?
Thanks
Didier