Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Derived Context Variables

Hi Team,

 

Lets say I have a context variables var1 and var2.

 

var1="abc"

I need var2 to be var1+" def"

 

Both var1 and var2 are on the same context group. How can I achieve that?

 

Labels (2)
19 Replies
Anonymous
Not applicable
Author


Hi @vapukov

 

Similar questions regular like - "we do the same in Informatica (Mulesoft, ODI, Pentaho ... ) and want exactly this"

 

It wrong ways of course.

 

Thanks for your reply. 
Considering Talend is relatively new in the ETL space comparison is inevitable.
We could argue that comparing is wrong, I am of the opinion if something works for one should be scope for improvement for the other.

 

Regards,

Rabi Panda

 

Anonymous
Not applicable
Author


@vapukov wrote:

for this I use only 1 context variable! 🙂

 

it name - context.env (I use 3 primary context group, but no limits at all)

prod - "prod"

qual - "qual"

dev - "dev"

 

in all other components (where it necessary ) all names concat like:

source_path == context.sourcefolder+"_"+context.env+"/data"

target_path == context.targetfolder+"_"+context.env+"/data"

 

and etc

same context.env used and run SubJob with dynamic context

 

 

When I need more than 3 - I just initialise context.env with individual value

 

Plus this variables used for load context values from csv file as part of filename

context.contextfilepath+"context_"+context.env+".csv"

and in any Job only 2 variables have value

- context.contextfilepath

- context.env

 

it give extremely flexibility


Yup we could do this, but then again I am sure you would agree, defining/computing the above expression at one place using it at the rest sounds a better approach.

 

Regards,

Rabi Panda

Anonymous
Not applicable
Author

First of all, never use Contexts other than default. Many people confuse the Context terminology. A context is your set of context variables (DEV, TEST, PROD, default, etc). A Context Group is a batch of related context variables. A Context variables is....well you know that. Using multiple Contexts just adds risk to process. You can mitigate this if you want to have multiple environments by using flat files or a database with the Implicit Context Load. You can make the Implicit Context Load as simple or as complicated (and secure, tailorable, etc) as you like. It is briefly described here https://help.talend.com/display/TalendOpenStudioforDataIntegrationUserGuide60EN/C.3.4+Configuring+th...

vapukov
Master II
Master II

may be not for 100% agree with - never/ever

 

life is different, so in some cases - it useful

 

in case when each job has it own context file - it easy to change file, but in case when many jobs share connection and other information ... better to have 

TAC allow change single variable for single Job, with Community version it not true, so You will need or add command line parameter for point to different context file (database). 

 

other case - my client work on windows server, I'm on Mac - file path will be different, so we have 2 Context at least, 1 point to my local context file, other point to his

 

 

on different projects - meet with all possible variant, but not sure which better

Anonymous
Not applicable
Author

Many of those issues (file paths, for example) can be resolved with operating system Environment Variables. My current use of Context Variables only uses default, makes use of environment variables and encrypted db parameters and Java routines in the Implicit Context Load config (yes, routines work there) allowing a pretty secure but easily malleable Context system. My Prod and Test environments cannot be changed without access to the context db, while the developers can all share context settings or set their own. This is pretty complicated, but once configured all it requires is administration of the context db.

The reason I dislike Contexs (Prod, Test, Dev, etc) is that if you have child jobs being called by parent jobs (who doesn't) you can easily run into issues when the Contexts are set incorrectly. This doesn't need to even be thought about with the system I use.

vapukov
Master II
Master II

agree, Your way is good.

 

I also have experience with OS variables, working solution.

 

for now I choose as flexible for my needs, next way:

in tRunJob:

0683p000009LtkW.png

and in context:

0683p000009LtT6.png

 

 

 

 

 

Anonymous
Not applicable
Author

Thanks @rhall

 

Trying to implement that.

However I am not able to reference the variables set using ImplicitCOntextLoad the same way we reference other contexts.

i.e. context.var1

 

Can you please help!

Anonymous
Not applicable
Author

You have to set the context variables up in the Job. Have you done this? By that I mean simply either add your Context Group (if you have them grouped) or create each variable in the contexts section of your job. Once they exist, the implicit context load will bring them in.

Anonymous
Not applicable
Author

In fact ignore the query, I had not defined it anywhere. Works for me now. Thanks for your help

Anonymous
Not applicable
Author

No problem