Task 2. Create a Mapping to Parse Data
In this task, you create a mapping and configure it to use data objects and a Parser transformation.
To create a mapping to parse data, complete the following steps:
1. Create a mapping.
2. Add source and target data objects to the mapping.
3. Add a Parser transformation to the mapping.
4. Configure the Parser transformation to parse the source column containing the full customer name into separate target columns containing the first name and last name.
Step 1. Create a Mapping
In this step, you create and name the mapping.
1. In the Object Explorer view, select your tutorial project.
2. Click File > New > Mapping.
The New Mapping window opens.
3. In the Name field, enter ParserMapping.
4. Click Finish.
The mapping opens in the editor.
Step 2. Add Data Objects to the Mapping
In this step, you add the LA_Customers data object and the LA_Customers_tgt data object to the mapping.
1. In the Object Explorer view, browse to the data objects in your tutorial project.
2. Select the LA_Customers data object and drag it to the editor.
The Add Physical Data Object to Mapping window opens.
3. Verify that Read is selected and click OK.
The data object appears in the editor.
4. In the Object Explorer view, browse to the data objects in your tutorial project.
5. Select the LA_Customers_tgt data object and drag it to the editor.
The Add Physical Data Object to Mapping window opens.
6. Select Write and click OK.
The data object appears in the editor.
7. Select the CustomerID, CustomerTier, and FullName ports in the LA_Customers data object. Drag the ports to the CustomerID port in the LA_Customers_tgt data object.
Tip: Hold down the CTRL key to select multiple ports.
The ports of the LA_Customers data object connect to corresponding ports in the LA_Customers_tgt data object.
Step 3. Add a Parser Transformation to the Mapping
In this step, you add a Parser transformation to the ParserMapping mapping.
1. Select the editor containing the ParserMapping mapping.
2. In the Transformation palette, select the Parser transformation.
3. Click the editor.
The New Parser Transformation window opens.
4. Verify that Token Parser is selected and click Finish.
The Parser transformation appears in the editor.
5. Select the FullName port in the LA_Customers data object and drag the port to the Input group of the Parser transformation.
The FullName port appears in the Parser transformation and is connected to the FullName port in the data object.
Step 4. Configure the Parser Transformation
In this step, you configure the Parser transformation to parse the column containing the full customer name into separate columns that contain the first name and last name.
1. Select the editor containing the ParserMapping mapping.
2. Click the Parser transformation.
3. Click Window > Show View > Properties.
4. In the Properties view, select the Strategies view.
5. Click New. The New Strategy wizard displays.
6. Click the selection arrow in the Inputs column, and choose the FullName port.
7. Select the character space delimiter [\s].
8. Click Next.
9. Select the Parse using Token Set operation, and click Next.
10. Select Fixed Token Sets (Single Output Only) and choose the Undefined token set.
11. Click the Outputs field and select New.
12. In the Operation Outputs dialog box, change the output name to Undefined_Output.
13. Click Finish.
14. In the Parser transformation, click the Undefined_Output port and drag it to the FirstName port in the LA_customers_tgt data object.
A connection appears between the ports.
15. In the Parser transformation, click the OverflowField port and drag it to the LastName port in the LA_customers_tgt data object.
A connection appears between the ports.
16. Click File > Save to save the mapping.