Saturday 25 June 2011

Parsing Procedure


Task 1. Create a Target Data Object
In this task, you create an LA_Customers_tgt data object that you can write parsed names to.
To create a target data object, complete the following steps:
1              Create an LA_Customers_tgt data object based on the LA_Customers.csv file.
2              Configure the read and write options for the data object, including file locations and file names.
3              Add Firstname and Lastname columns to the LA_Customers_tgt data object.

Step 1. Create an LA_Customers_tgt Data Object
In this step, you create an LA_Customers_tgt data object based on the LA_Customers.csv file.
1              Click File > New > Data Object. The New window opens.
2              Select Flat File Data Object and click Next.
3              Verify that Create from an existing flat file is selected.

4.             Click Browse and navigate to LA_Customers.csv in the following directory: \clients\DeveloperClient\Tutorials

5.             Click Open.

6.             In the Name field, enter LA_Customers_tgt.

7.             Click Next.

8.             Click Next.

9.             In the Preview Options section, select Import column names from first line and click Next.

10.           Click Finish. The LA_Customers_tgt data object appears in the editor.

Step 2. Configure Read and Write Options
In this step, you configure the read and write options for the LA_Customers_tgt data object, including file locations and file names.

1.             Verify that the LA_Customers_tgt data object is open in the editor.

2.             In the editor, select the Read view.

3.             Click Window > Show View > Properties.

4.             In the Properties view, select the Runtime view.

5.             In the Value column, double-click the source file name and type LA_Customers_tgt.csv.

6.             In the Value column, double-click to highlight the source file directory.

7.             Right-click the highlighted name and select Copy.

8.             In the editor, select the Write view.

9.             In the Properties view, select the Runtime view.

10. In the Value column, double-click the Output file directory entry.

11. Right-click and select Paste to paste the directory location you copied from the Read view.

12. In the Value column, double-click the Header options entry and choose Output Field Names.

13. In the Value column, double-click the Output file name entry and type LA_Customers_tgt.csv.

14. Click File > Save to save the data object.

Step 3. Add Columns to the Data Object
In this step, you add Firstname and Lastname columns to the LA_Customers_tgt data object.
1              In the Object Explorer view, browse to the data objects in your tutorial project.
2              Double-click the LA_Customers_tgt data object. The LA_Customers_tgt data object opens in the editor.
3              Verify that the Overview view is selected.
4              Select the FullName column and click the New button to add a column. A column named FullName1 appears.
5              Rename the column to Firstname. Click the Precision field and enter "30."
6              Select the Firstname column and click the New button to add a column. A column named FirstName1 appears.
7              Rename the column to Lastname. Click the Precision field and enter "30."
8              Click File > Save to save the data object .

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.

Task 3. Run a Profile on the Parser Transformation
In this task, you run a profile on the Parser transformation to verify that you configured the Parser transformation to parse the full name correctly.
1              Select the editor containing the ParserMapping mapping.
2              Right-click the Parser transformation and select Profile Now. The profile runs and opens in the editor.
3              In the editor, click the Results view to display the result of the profiling operation.
4              Select the Undefined_output column to display information about the column in the Details section.

52 Chapter 13: Lesson 4. Parsing Data
The values contained in the Undefined_output column appear in the Details section, along with frequency and percentage statistics for each value.
5.             View the data and verify that only first names appear in the Undefined_output column.
Task 4. Run the Mapping
In this task, you run the mapping to create the mapping output.
1              Select the editor containing the ParserMapping mapping.
2              Click Run > Run Mapping. The mapping runs and writes output to the LA_Customers_tgt.csv file.

Task 5. View the Mapping Output
In this task, you run the Data Viewer to view the mapping output.

1.             In the Object Explorer view, locate the LA_Customers_tgt data object in your tutorial project and double click

the data object. The data object opens in the editor.

2.             Click Window > Show View > Data Viewer. The Data Viewer view opens.

3.             In the Data Viewer view, click Run. The Data Viewer runs and displays the data.

4.             Verify that the FirstName and LastName columns display correctly parsed data.

No comments:

Post a Comment