Six Stars

Talend 6.2.1 Context Variable

Hi,

 

I am trying to create context variable and want to use in tMap to remove hard coding from my talend job. I saw multiple example, everywhere context group has three tabs namely Variable, Value as tree, value as table whereas there is no such tab in my case. PFA screen shot.

talend_context.jpg

 

How to create context varaible in Talend 6.2.1 and how we can use them in tMap?

 

Another requirement is to create context variable and store path in it. Read that path from context variable while create metadata of flat file. Is that possible? If yes, how?

  • Data Integration
  • SDI
  • Talend Integration Cloud
11 REPLIES
Nine Stars TRF
Nine Stars

Re: Talend 6.2.1 Context Variable

Hi,

Hit the + sign at the bottom left to add a context variable then enter name, type and value.

This will populates variable for default context.

Hit the + sign at the upper right to add a new context (corresponding to different execution environment).

Context variable can be used almost everywhere (not only tMap) using "context.myVariable".

 

Context variable are populated at runtime (when job starts). They are not available when defining repository elements.

 

Regards,


TRF
Ten Stars

Re: Talend 6.2.1 Context Variable

If you want to create a context variable that is local to your job, click the green plus button at the bottom left in your screenshot.  Give the new variable a name, type, and optional comment and default.  To reference the variable in your job, type context.varName (e.g. if your variable is named basePath: context.basePath)

Six Stars

Re: Talend 6.2.1 Context Variable

I created metadata using wizard and there we have to select filename with path. Can we use context variable there or is there any way we create automated metadata using context variable?

Tags (1)
Nine Stars TRF
Nine Stars

Re: Talend 6.2.1 Context Variable

As said, I think you cannot use context variables for this purpose


TRF
Six Stars

Re: Talend 6.2.1 Context Variable

Can we use context variables while saving output using tFileOutputDelimiter? 

Nine Stars TRF
Nine Stars

Re: Talend 6.2.1 Context Variable

As said, context variable can be used almost everywhere (not only tMap) using "context.myVariable".


TRF
Ten Stars

Re: Talend 6.2.1 Context Variable

Are you asking if you can create a File metadata entry and reference a context variable for the path and filename?

Six Stars

Re: Talend 6.2.1 Context Variable

Once the context variable has been created is there a way to "publish" it so it gets listed when you use keystroke Control+spacebar

Six Stars

Re: Talend 6.2.1 Context Variable

If you create a local context.variable it will automatically come in template proposals, however when you create a context using the left repository panel you will need to select the newly added context into your context list from repository context
Six Stars

Re: Talend 6.2.1 Context Variable

Thanks, I thought once I added it once to my context list all new variables added via the left would be included

Six Stars

Re: Talend 6.2.1 Context Variable

Hi,

 

I am creating big data spark job and want to read all the context variable from flat file. I am using Talend big data platform 6.2.1

 

Is it possible? How?