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.
How to accomplish it…
The steps for creating a context group are as follows:
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.
In this recipe, we have created a basic context, but there are more features that you can explore.
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.
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:
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.
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:
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.
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:
Another method of adding the context to the job from the metadata is to drag the context metadata icon in the Contexts panel.
Get Updates on Tech posts, Interview & Certification questions and training schedules