How to get the current active context name ?

One Star

How to get the current active context name ?

Hi guys,
I need to make a distinction depending on the active context.
In "Default" i need to run a special job whereas in "Production" and "Test" context i don't have to.
Is there a way to deal with that, a way to retrieve the current or active context name ?
Thanks in advance,
Five Stars

Re: How to get the current active context name ?

Hi gavelin,
In Java, try contextStr.equals("Default").
Cheers,
c0utta
Community Manager

Re: How to get the current active context name ?

Hello
Is there a way to deal with that, a way to retrieve the current or active context name ?

Yes, there is a variable store the currnet context name
System.out.println(contextStr);

Best regards

shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: How to get the current active context name ?

Does anyone know how to access contextStr in e.g. the properties for a component such as tFileCopy?

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 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog