Four Stars

[Talend job] Let the user choosing between two different contexts when he executes the job

Hello All,

I have a job that I want to execute with two different contexts.

In Talend, I have my two contexts set up, and it is quite easy to switch between them by selected one of them in the Run tab.

But after building the job, I am executing it by launching the .bat file, and there is only one context that is set up in the file (with the --context parameter). I have my two contexts in two properties file in the contexts folder, so I suppose that I just need to pass the right context into the --context variable in the .bat file, but I need to design a job where the user won't need to edit the .bat file.

I thought about passing a parameter into the --context variable in the .bat file, but I don't know how to proceed.

Is there someone who have an idea about this need?

Thanks

 

3 REPLIES
Moderator

Re: [Talend job] Let the user choosing between two different contexts when he executes the job

Hello,

You are able to define variable context value from the command line.

Please have a look at this online document:https://help.talend.com/reader/QrWkwPvKmKybs~JNLeBt3Q/bR16_SpzewPBtorvHtIgpA

Additionally, you can use tContextLoad component  to load context variables dynamically from a delimited file(e.g.) as well when you run the job with different environments.

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

Re: [Talend job] Let the user choosing between two different contexts when he executes the job

Hello,

Is this solution OK with you? Feel free to post your issue on forum.

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

Re: [Talend job] Let the user choosing between two different contexts when he executes the job

I think the most appropriate solution is to create two context files and load them through the command line. I did that and it seems to work fine. For the tContextLoad component, I'm not sure that it corresponds to my need because how do you choose which context you want to use when you have two contexts set up in the component? The user won't execute the job through Talend but only through a command line.