Setting Boolean UI fields with context variables - HOW-TO

One Star

Setting Boolean UI fields with context variables - HOW-TO

Hi there;
In most components we can set the value of a field by using context variables. So for example in a DB component we can replace  host "myhost" by host context.myHost after having set the myHost environment variable. This works great.

My issue is with the tFileCopy component. There is a series of "check mark" (Boolean" fields in the component UI. One specific one "Remove Source File". This effectively change a copy behavior to a move.
I want to change the value of this "Remove Source File" Boolean check mark but at run time based on my environment variable which tells me I'm in Prod or Dev.
Basically I want something like this
if (context.Environment == "Prod") then set "Remove Source File" to true
So my question is how to I access those Boolean type variables in the UI?

Highlighted
Moderator

Re: Setting Boolean UI fields with context variables - HOW-TO

Hi,
Have you tried to use "Run If" trigger in your job design and set condition as:
 if (context.Environment == "Prod") then trigger tfilecopy with "Remove Source File" option.
 if (context.Environment == "Dev") then triiger tfilecopy_2 without "Remove Source File" option?
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.
Highlighted
One Star

Re: Setting Boolean UI fields with context variables - HOW-TO

Thank you. not very elegant but functional. It would work.

2019 GARTNER 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

Best Practices for Using Context Variables with Talend – Part 2

Part 2 of a series on Context Variables

Blog

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