One Star

running generic jobs passing them connection parameters

Hi, i'm new to talend and looking to run generic jobs multiple times changing the connection parameters each time.
I've put connection params in csv files, then created a general context in the job with the same fields;
the step i'm missing is how to iterate through the csv files fetching each context params in all the sub jobs.
thanks
5 REPLIES
One Star

Re: running generic jobs passing them connection parameters

Try tContextLoad to load the context values to the context variables and configure the input connection with the context variable
use looping mechanism to fetch multiple files
One Star

Re: running generic jobs passing them connection parameters

Hello. To do this, you can use a tFileList component to look for your parameter CSV files. Connect it to a tFileInputDelimited via the iterate link - the input file path on it is going to . Connect the tFileInputDelimited's row link to a tContextLoad. Connect a second iterate link from the tFileList to the rest of what you need to do. An example of this is in the image I've added below.
Seventeen Stars

Re: running generic jobs passing them connection parameters

A bit to complicated ;-)
For reading values into the context variables I would suggest using the implicit context load. Thi setting can be set or changed for all jobs of a project at once.
Open a job and the view Job->Extra
One Star

Re: running generic jobs passing them connection parameters

A bit to complicated ;-)
For reading values into the context variables I would suggest using the implicit context load. Thi setting can be set or changed for all jobs of a project at once.
Open a job and the view Job->Extra

tnx everyone for the replies
but if i use implicit context load should i change it manually and run the project as many times as the contexts?
One Star

Re: running generic jobs passing them connection parameters

Yes, with implicit, you'd have to make changes within the Studio at run time.
Similar to what rpbaldwin suggested, use the tFileList to read a directory that has all your CSV context files, filtering for a particular file type every time you execute the job. For example, you have 3 files in there named as follows:
myContexts_DEV.txt
myContexts_QA.txt
myContexts_PRD.txt
You add a context to the job, which I called RuntimeEnvironment in the attached screenshot. When running the job, you set only the value of this context (DEV, QA or PRD). tFileList filters the directory contents for what matches the file name. tContext load loads all the parameters into your job.
Using this method, if you were deploying the job on a server (outside TAC), you'd simply have to override this one context when calling the job from a command line - all the others would loaded accordingly.