The Lookup feature allows you to take data from an existing dataset and add it to your preparation.
This example assumes that:
- You have downloaded the states.csv file, provided in the Downloads tab of the menu located on the left side of the documentation portal.
- You have added states.csv to your list of datasets in Talend Data Preparation. For more information about how to import a dataset, see Opening a dataset from a local file.
In this example, you want to add more geographical information on your customers, thanks to a reference file that you possess: the States dataset. This dataset contains the list of the US State codes, and their corresponding region. You will dynamically use the data from this dataset to complement your preparation. This will allow you to add information about each customer's subscription region, based on their State code.
To blend the data from another dataset in your preparation, proceed as follows:
- Click the header of the STATE column to select its content.
- Click the Lookup icon in the upper part of the
The Add data from lookup panel opens at the bottom of the screen.
- Click the + icon to select the dataset you want to
The list of previously imported datasets opens. In your case, only States is available.
- Select the check box next to States and then click
The States dataset opens in the bottom part of the screen. You can see that it is only made of two columns, including STATE that can also be found in your current preparation.
- Select the STATE column in both your preparation and the
dataset, so that they appear in blue.
Your preparation and the dataset can only be linked together if they have a column with information in common, the US State codes in this case.
- In the States dataset, select the check box Add
to Dataset under the REGION column header
to add it to your current preparation.
- Point your mouse over the Confirm button to preview the
- Click the Confirm button to apply the changes and add the REGION column to your preparation.
Your data now includes a new information about the subscription region of your customer, that you extracted from a reference file.