In this lesson, you add a rule that splits a value and
maps each part of the split value to a different output column.
Overview
Records
in input data might contain information that is concatenated. For
example, the input data might contain the value 195CM. This value
concatenates 195, which represents an amount, and CM, which represents
a unit of measure. To distinguish the amount from the unit of measure,
you can add a rule that maps each part of the input value to a different
output column.
Procedure
- Click the Rules tab, select the
Input_Overrides rule group, and then click Open.
- Expand Pattern Rule. A
list of patterns in the data is shown.
- Expand B+>CTT, and then click Unhandled
Records. An example record is shown.
One of the values in the record, which is represented in the pattern
as >, includes leading digits followed by letters.
- If the example record on the Define Rule page is not TRAILCHEF
CANTEEN 2LITERS BROWN COOKING GEAR, select TRAILCHEF CANTEEN 2LITERS
BROWN COOKING GEAR from the list of example records. If
TRAILCHEF CANTEEN 2LITERS BROWN COOKING GEAR is not in the list of
example records, increase the number of records in the list.
- In the upper-right corner of the Browse Rules pane,
click .
- From the Records to Display list,
select 100.
- Click OK. The
list of example records includes TRAILCHEF CANTEEN 2LITERS BROWN COOKING
GEAR. You can select the record from the list.
- Map the values from the example record to the appropriate
output columns by dragging the values to the column. The
following table shows the output column for each value.
Table 1. Output
columns for each value in the recordValue |
Output column |
TRAILCHEF |
ProductBrand |
CANTEEN |
ProductName |
2LITERS |
SizeUnit |
BROWN |
ProductColor |
COOKING |
ProductType |
GEAR |
ProductType |
The values from the example records are
mapped to the output columns. However, the value in the SizeUnit output
column contains a value that belongs in the SizeType output column.
- In the SizeUnit output column, right-click 2LITERS, and
then click Edit Action. In the Action
windows, you can manipulate the data that is sent to the output column.
- Edit the action to add only the leading digits to the SizeUnit
output column:
- From the Object list, select Prefix.
- Click All leading digits. The Example Result field shows
the value 2.
- Click Specify action for remaining characters,
and then click OK. The Actions window
opens. Options are selected that specify an action for the characters
that you did not map to the SizeUnit output column.
- Map the remaining characters to the SizeType output column:
- From the Output Column list,
select SizeType.
- Click OK.
The values are shown in the correct output columns.
- Apply the rule to the pattern:
- Click Apply as New Rule.
- In the Name field, enter Split
size values.
- Click OK.
The rule is added and is shown under the
B+>CTT pattern.