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

Five 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

 

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

15TH OCTOBER, COUNTY HALL, LONDON

Join us at the Community Lounge.

Register Now

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Why Companies Move to the Cloud: 7 Success Stories

Learn how and why companies are moving to the Cloud

Read Now