Table of Contents

Search

  1. Preface
  2. Mappings
  3. Parameters
  4. CLAIRE recommendations
  5. Data catalog discovery
  6. Visio templates

Mappings

Mappings

Step 3. Create a Filter transformation

Step 3. Create a Filter transformation

In the following procedure, you create a Filter transformation to filter accounts based on the state in which each account is located. You also create a parameter to hold state values.
You want this mapping to run tasks that filter accounts based on specific states. To accomplish this, you add a Filter transformation to the data flow to capture state information. You then define a parameter in the filter condition to hold the state value. When you use a parameter, you can reuse the same mapping to create multiple tasks. You can specify a different state value for each task. Or you can use the same
mapping
task and change the value for state when you run the task.
The sample Account source file includes a State field. When you use the State field in the filter condition, you can write data to the target based on the state. For example, when you use State = MD as the condition, you include accounts based in Maryland in the data flow. When you use a parameter for the value of the filter condition, you can define the state that you want to use when you run the task.
Field rules define the fields that enter the transformation and how they are named. By default, all available fields are included in the transformation. You might want to exclude unnecessary fields when you have large source files. Or you might want to change the names of certain incoming fields, for example, when you have multiple sources in a mapping. Field rules are configured on the
Incoming Fields
tab. For this tutorial, do not configure field rules.
  1. To add a Filter transformation, drag a Filter transformation from the Transformation palette to the mapping canvas and drop it between the src_FF_Account Source transformation and the NewTarget transformation.
    You might need to scroll through the Transformation palette to find the Filter transformation.
    When you drop a new transformation in between two transformations in the canvas, the new transformation is automatically linked in the data flow, as shown in the following image:
    The Source, Filter, and Target transformations display in a row in the mapping canvas with lines between the transformations, which illustrates that the transformations are connected in the data flow.
    When you link transformations, the downstream transformation inherits fields from the previous transformation.
  2. To configure the Filter transformation, select the Filter transformation on the mapping canvas.
  3. To name the Filter transformation, in the Properties panel, click
    General
    and enter
    flt_Filter_by_State
    for the Filter transformation name.
  4. To create a simple filter with a parameter for the value, click
    Filter
    . For the
    Filter Condition
    , select
    Simple
    .
  5. Click
    Add New Filter Condition
    , as shown in the following image:
    A message in the Filter Conditions table says there are no filter conditions specified. When you click the Add New Filter Condition icon, a row is created in the table for the new condition.
    When you click
    Add New Filter Condition
    , a new row is created where you specify values for the new filter condition.
  6. For
    Field Name
    , select
    State
    .
  7. For
    Operator
    , select
    Equals
    .
  8. To parameterize the filter condition value, for
    Value
    , select
    New Parameter
    .
  9. In the
    New Parameter
    dialog box, configure the following options:
    Filter Condition Detail
    Description
    Name
    Name of the filter condition.
    Enter
    p_FilterConditionValue
    for the name.
    Display Label
    Label that shows in the
    mapping
    task wizard where you enter the condition value.
    Enter
    Filter Value for State
    for the label.
    Description
    Description that appears in the
    mapping
    task wizard.
    Enter this text for the description:
    Enter the two-character state name for the data you want to use.
    Type
    Datatype of the field used for the filter condition.
    The State field is a String datatype, which is already specified in the dialog box.
    Default Value
    Default value for the filter condition. The
    mapping
    task uses this value unless you specify a different value.
    You want to run the task for accounts in Maryland by default, so enter
    MD
    .
  10. Click
    OK
    . The new filter condition displays in the Properties panel, as shown in the following image:
    The Filter Conditions table shows the completed filter condition.
  11. To save your changes, click
    Save
    .