Talend Tutorials



| Matt Irvin

Sometimes it is valuable to bring context variables in from an external file at runtime. For this, the tContextLoad component can help. The following job design will give a quick tutorial to give some understanding on to how this component works.

Step 1: Set Up Context

In this job, open the Context tab and add three variables, in this case I’ve made them city, state, and zip. There is no need to assign any values to them.

image 1

Step 2: Files to Context

Drag a FileInputDelimited component and the tContextLoad component onto your canvas, connecting them as shown below.

image 2

Entering the component tab, select the FileInputDelimited component, and sync columns with the ContextLoad. Add the input file in file name. After this, open the component for the ContextLoad variable and enable the “Print operations” option.

image 3

Step 3: Viewing results

The previous steps, when run, will successfully load your new variables with values. To view these, we must make a new subjob. Add in a FixedFlowInput and connect it to a LogRow component. Then have this run off a trigger on subjob ok from the first job.

image 4

Edit the schema in the fixedflow component and add three columns. The names of these don’t matter, but make sure each of your saved context variables are accessed, as shown below.

image 5

Finally, run the job and see your output.

Notice the first three lines are generated by the “Print operations” option enabled in the ContextLoad component, telling you the values loaded.

image 6

Looking For More Talend Help?
Contact Us Today