Home  >  Blog  >   Talend

Creating and Adding a Context Group to Your Job - TALEND

User-defined parameters are supplied to your Job during runtime, and this is known as "context." During the promotion of your job from development to test and production, the values of context variables may change. We've outlined the steps for building and adding a Context Group to your Talend job.

Rating: 5
  
 
5162
  1. Share:

Creating a context group

A context group is a set of (usually) related context variables for use within a project. This recipe shows how to create a new context group.

If you would like to Enrich your career with a Talend certified professional, then visit Mindmajix - A Global online training platform: “Talend Online Training”  Course. This course will help you to achieve excellence in this domain.

How to accomplish it…

The steps for creating a context group are as follows:

  • Open the metadata panel, and right-click on the context section.
  • Select the Create context group
  • Name the new group cookbookGeneral.
  • Click on the Next button, and you will see the main context variable panel.
  • Click on + to add a new variable and type in cookbookDirectory.
  • Set the type to the Directory.
  • Now, click on the Values as a table tab, and click on the Default column for cookbookDirectory. Click on the …
  • This will open a directory navigation window, so navigate to the cookbook data directory, and click on Finish.

How it works…

The context group is created in the metadata panel, and the individual context variables can then be added, along with their default values. Because we chose the type as the Directory, Talend gives us the option of using a windows dialogue to simplify the mechanism for selecting the directory we wish to use.

------        Related Page: Using tContextLoad and Implicit Context Loading to Load Contexts in Talend        ------

There’s more…

In this recipe, we have created a basic context, but there are more features that you can explore.

MindMajix Youtube Channel

Context types

The context dialogue allows many different types of context variables to be defined, and in some cases, as in this recipe, it will provide a dialogue to make definition easier.

Prompt for variable values using the tree mode

Updating values in the context group can also be done in the tree mode. This is an alternative method that differs in one important way.

The tree mode provides an option that will prompt for a value to be displayed at runtime, by checking the prompt box for a variable.

Promptvariable

 

 

The prompt will appear at runtime, as shown in the following screenshot, and is a useful means for providing test values when developing a job:

Run context default

Adding a context group to your job

A job will not automatically use a CONTEXT GROUP. This exercise shows how to add a context group to a job.

Frequently Asked TALEND Interview Questions & Answers

Getting ready

Open the jo_cook_ch06_0010_addContextGroup job.

How to achieve it…

The steps for adding a context group to your job are as follows:

  • Open the context panel, and click on the context icon shown as follows:

Contexts

  • You will then be presented with the list of available context groups.
  • Select cookbookDB, and then Ok.
  • You will now see that the cookbookDB context variables have been added as read-only variables into the job.

------        Check Out Talend Tutorials        ------

How it works…

The context dialogue within a job allows single (in the job) contexts, as well as context groups, to be added to a job.

There’s more…

The preceding method shows how to add all context variables into a job. There is also an option to add only a subset of the variables within the group, if you drill down into the context group when selecting, demonstrated as follows:

Select context variables

Tip

Another method of adding the context to the job from the metadata is to drag the context metadata icon in the Contexts panel.

Explore TALEND Sample Resumes! Download & Edit, Get Noticed by Top Employers!Download Now!
Join our newsletter
inbox

Stay updated with our newsletter, packed with Tutorials, Interview Questions, How-to's, Tips & Tricks, Latest Trends & Updates, and more ➤ Straight to your inbox!

Course Schedule
NameDates
Talend TrainingMar 23 to Apr 07View Details
Talend TrainingMar 26 to Apr 10View Details
Talend TrainingMar 30 to Apr 14View Details
Talend TrainingApr 02 to Apr 17View Details
Last updated: 03 Apr 2023
About Author

Ravindra Savaram is a Technical Lead at Mindmajix.com. His passion lies in writing articles on the most popular IT platforms including Machine learning, DevOps, Data Science, Artificial Intelligence, RPA, Deep Learning, and so on. You can stay up to date on all these technologies by following him on LinkedIn and Twitter.

read more