router transformation overview

10
Router Transformation Overview Transformation type: Active Connected A Router transformation is similar to a Filter transformation because both transformations allow you to use a condition to test data. A Filter transformation tests data for one condition and drops the rows of data that do not meet the condition. However, a Router transformation tests data for one or more conditions and gives you the option to route rows of data that do not meet any of the conditions to a default output group. If you need to test the same input data based on multiple conditions, use a Router transformation in a mapping instead of creating multiple Filter transformations to perform the same task. The Router transformation is more efficient. For example, to test data based on three conditions, you only need one Router transformation instead of three filter transformations to perform this task. Likewise, when you use a Router transformation in a mapping, the Integration Service processes the incoming data only once. When you use multiple Filter transformations in a mapping, the Integration Service processes the incoming data for each transformation. Figure 18-1 shows two mappings that perform the same task. Mapping A uses three Filter transformations while Mapping B produces the same result with one Router transformation: Working with Groups A Router transformation has the following types of groups: Input Output Input Group

Upload: yprajudwh

Post on 18-Nov-2014

608 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Router Transformation Overview

Router Transformation Overview

Transformation type:ActiveConnected

A Router transformation is similar to a Filter transformation because both transformations allow you to use a condition to test data. A Filter transformation tests data for one condition and drops the rows of data that do not meet the condition. However, a Router transformation tests data for one or more conditions and gives you the option to route rows of data that do not meet any of the conditions to a default output group.

If you need to test the same input data based on multiple conditions, use a Router transformation in a mapping instead of creating multiple Filter transformations to perform the same task. The Router transformation is more efficient. For example, to test data based on three conditions, you only need one Router transformation instead of three filter transformations to perform this task. Likewise, when you use a Router transformation in a mapping, the Integration Service processes the incoming data only once. When you use multiple Filter transformations in a mapping, the Integration Service processes the incoming data for each transformation.

Figure 18-1 shows two mappings that perform the same task. Mapping A uses three Filter transformations while Mapping B produces the same result with one Router transformation:

Working with Groups

A Router transformation has the following types of groups:

InputOutput

Input Group

The Designer copies property information from the input ports of the input group to create a set of output ports for each output group.

Output Groups

There are two types of output groups:

User-defined groupsDefault group

You cannot modify or delete output ports or their properties.

Page 2: Router Transformation Overview

User-Defined Groups

You create a user-defined group to test a condition based on incoming data. A user-defined group consists of output ports and a group filter condition. You can create and edit user-defined groups on the Groups tab with the Designer. Create one user-defined group for each condition that you want to specify.

The Integration Service uses the condition to evaluate each row of incoming data. It tests the conditions of each user-defined group before processing the default group. The Integration Service determines the order of evaluation for each condition based on the order of the connected output groups. The Integration Service processes user-defined groups that are connected to a transformation or a target in a mapping. The Integration Service only processes user-defined groups that are not connected in a mapping if the default group is connected to a transformation or a target.

If a row meets more than one group filter condition, the Integration Service passes this row multiple times.

The Default Group

The Designer creates the default group after you create one new user-defined group. The Designer does not allow you to edit or delete the default group. This group does not have a group filter condition associated with it. If all of the conditions evaluate to FALSE, the Integration Service passes the row to the default group. If you want the Integration Service to drop all rows in the default group, do not connect it to a transformation or a target in a mapping.

The Designer deletes the default group when you delete the last user-defined group from the list.

Using Group Filter Conditions

You can test data based on one or more group filter conditions. You create group filter conditions on the Groups tab using the Expression Editor. You can enter any expression that returns a single value. You can also specify a constant for the condition. A group filter condition returns TRUE or FALSE for each row that passes through the transformation, depending on whether a row satisfies the specified condition. Zero (0) is the equivalent of FALSE, and any non-zero value is the equivalent of TRUE. The Integration Service passes the rows of data that evaluate to TRUE to each transformation or target that is associated with each user-defined group.

For example, you have customers from nine countries, and you want to perform different calculations on the data from only three countries. You might want to use a Router transformation in a mapping to filter this data to three different Expression transformations.

Page 3: Router Transformation Overview

There is no group filter condition associated with the default group. However, you can create an Expression transformation to perform a calculation based on the data from the other six countries.

Figure 18-3 shows a mapping with a Router transformation that filters data based on multiple conditions:

In the session, the Integration Service passes the rows of data that evaluate to TRUE to each transformation or target that is associated with each user-defined group, such as Japan, France, and USA. The Integration Service passes the row to the default group if all of the conditions evaluate to FALSE. If this happens, the Integration Service passes the data of the other six countries to the transformation or target that is associated with the default group. If you want the Integration Service to drop all rows in the default group, do not connect it to a transformation or a target in a mapping.

Adding Groups

Adding a group is similar to adding a port in other transformations. The Designer copies property information from the input ports to the output ports.

To add a group to a Router transformation:

1. Click the Groups tab.2. Click the Add button.

Page 4: Router Transformation Overview

3. Enter a name for the new group in the Group Name section.4. Click the Group Filter Condition field and open the Expression Editor.5. Enter the group filter condition.6. Click Validate to check the syntax of the condition.7. Click OK.

Working with Ports

A Router transformation has input ports and output ports. Input ports are in the input group, and output ports are in the output groups. You can create input ports by copying them from another transformation or by manually creating them on the Ports tab.

The Designer creates output ports by copying the following properties from the input ports:

Port nameDatatypePrecisionScaleDefault value

Page 5: Router Transformation Overview

When you make changes to the input ports, the Designer updates the output ports to reflect these changes. You cannot edit or delete output ports. The output ports display in the Normal view of the Router transformation.

The Designer creates output port names based on the input port names. For each input port, the Designer creates a corresponding output port in each output group.

Figure 18-5 shows the output port names of a Router transformation that correspond to the input port names:

Page 6: Router Transformation Overview

When you connect transformations to a Router transformation in a mapping, consider the following rules:

Page 7: Router Transformation Overview

You can connect one group to one transformation or target.

You can connect one output port in a group to multiple transformations or targets.

You can connect multiple output ports in one group to multiple transformations or targets.

You cannot connect more than one group to one target or a single input group transformation.

You can connect more than one group to a multiple input group transformation, except for Joiner transformations, when you connect each output group to a different input group.

Creating a Router Transformation

To add a Router transformation to a mapping, complete the following steps.

To create a Router transformation:

1. In the Mapping Designer, open a mapping.2. Click Transformation > Create.Select Router transformation, and enter the name of the new transformation. The naming convention for the Router transformation is RTR_TransformationName. Click Create, and then click Done.

3. Select and drag all the ports from a transformation to add them to the Router transformation, or you can manually create input ports on the Ports tab.

4. Double-click the title bar of the Router transformation to edit transformation properties.

5. Click the Transformation tab and configure transformation properties.6. Click the Properties tab and configure tracing levels.

7. Click the Groups tab, and then click the Add button to create a user-defined group.

The Designer creates the default group when you create the first user-defined group.8. Click the Group Filter Condition field to open the Expression Editor.9. Enter a group filter condition. 10. Click Validate to check the syntax of the conditions you entered.11. Click OK.12. Connect group output ports to transformations or targets.