Five Stars

HashOutput per iteration not all iterations at once

Hi

 

I'm iterating a tFileList and generate a HashOutput. The HashOutput collects the data from every iteration. How can I configure my Job so that the HashInput is executed every iteration?

 

This is my Job so far:

job.jpg

 

Best regards

Yannek

  • ESB
1 ACCEPTED SOLUTION

Accepted Solutions
Eleven Stars

Re: HashOutput per iteration not all iterations at once

In which case, copy everything from your job apart from the tFileList. Paste it into another job. Create a context variable to use as the filepath. Now drag the new job into the old job and connect it to the tFileList. Supply the tFileList path variable to the context variable you just created (this can be done in the tRunJob settings). Now for every file, the whole of your child job will run.

 

I also noticed that not all of you subjobs were linked. You should do this with SubJobOK links to prevent timing issues. 

Rilhia Solutions
6 REPLIES
Eleven Stars

Re: HashOutput per iteration not all iterations at once

Do you want the whole job to run completely for each file (or iteration)? So it will run from beginning to end for the first file, then again for the second file, etc, etc? If so, it might be easier for you to put the bulk of this job into another job and add it as a child job to this job just after the tFileList component.

Rilhia Solutions
Five Stars

Re: HashOutput per iteration not all iterations at once

I want the whole job to run for every iteration.

The first part is extracting information, second part is extracting information from DB and the tJava component uses these informations. Everything needs to be done for every file.

Eleven Stars

Re: HashOutput per iteration not all iterations at once

In which case, copy everything from your job apart from the tFileList. Paste it into another job. Create a context variable to use as the filepath. Now drag the new job into the old job and connect it to the tFileList. Supply the tFileList path variable to the context variable you just created (this can be done in the tRunJob settings). Now for every file, the whole of your child job will run.

 

I also noticed that not all of you subjobs were linked. You should do this with SubJobOK links to prevent timing issues. 

Rilhia Solutions
Five Stars

Re: HashOutput per iteration not all iterations at once

 

How exactly do I set the context variable to the filepath without a java component?

To use the context variable in the child job, do I need to set the option "Transmit whole context" or use "Context Param" on the tRunJob component?

 

Sorry for the silly questions but I have only used static context variables up until now.

Eleven Stars

Re: HashOutput per iteration not all iterations at once

Create a context variable in your new job (the child job) called "MyFilePath". Set your file component's file path to be "context.MyFilePath". Now in your parent job go to the tRunJob that has been dragged in and look at the "Context Param" section. Add your "MyFilePath" context variable (it will be available after you click on the green "+" symbol below the "Context Param" box). Then set that to be the value that was previously set in your file component. 

 

An example of this can be seen in the 3) "Call ConnectBy Job" (tRunJob) section of this tutorial.... https://www.rilhia.com/tutorials/talend-connect-example

The tutorial has nothing to do with this problem, but passing context variables between parent and child jobs is shown.

Rilhia Solutions
Five Stars

Re: HashOutput per iteration not all iterations at once

Thanks for the detailed solution, everything is working fine now.