Sie sind auf Seite 1von 3

Filter Transformation

Overview: Transformation type: 1. Active 2. Connected Use the Filter transformation to filter out rows in a mapping. As an active transformation, the Filter transformation may change the number of rows passed through it. The Filter transformation allows rows that meet the specified filter condition to pass through. t drops rows that do not meet the condition. !ou can filter data based on one or more conditions. A filter condition returns T"U# or FA$%# for each row that the ntegration %ervice evaluates, depending on whether a row meets the specified condition. For each row that returns T"U#, the ntegration %ervices pass through the transformation. For each row that returns FA$%#, the ntegration %ervice drops and writes a message to the session log. The following mapping passes the rows from a human resources table that contains employee data through a Filter transformation. The filter allows rows through for employees that ma&e salaries of '(),))) or higher. !ou cannot concatenate ports from more than one transformation into the Filter transformation. The input ports for the filter must come from a single transformation. Transformation type* Active Connected 1+) Chapter ,* Filter Transformation Tip* -lace the Filter transformation as close to the sources in the mapping as possible to ma.imi/e session performance. "ather than passing rows you plan to discard through the mapping, you can filter out unwanted data early in the flow of data from sources to targets. Filter Transformation Components !ou can create a Filter transformation in the Transformation 0eveloper or the 1apping 0esigner. A Filter transformation contains the following tabs* Transformation. #nter the name and description of the transformation. The naming convention for a Filter transformation is F $2Transformation3ame. !ou can also ma&e the transformation reusable. -orts. Create and configure ports. -roperties. Configure the filter condition to filter rows. Use the #.pression #ditor to enter the filter condition. !ou can also configure the tracing level to determine the amount of transaction detail reported in the session log file. 1etadata #.tensions. Create a non4reusable metadata e.tension to e.tend

the metadata of the transformation transformation. Configure the e.tension name, datatype, precision, and value. !ou can also promote metadata e.tensions to reusable e.tensions if you want to ma&e it available to all transformation transformations. Configuring Filter Transformation -orts !ou can create and modify ports on the -orts tab. !ou can configure the following properties on the -orts tab* -ort name. 3ame of the port. 0atatype, precision, and scale. Configure the datatype and set the precision and scale for each port. -ort type. All ports are input5output ports. The input ports receive data and output ports pass data. 0efault values and description. %et default value for ports and add description. Filter Condition The filter condition is an e.pression that returns T"U# or FA$%#. #nter conditions using the #.pression #ditor available on the -roperties tab. Any e.pression that returns a single value can be used as a filter. For e.ample, if you want to filter out rows for employees whose salary is less than '(),))), you enter the following condition*

%A$A"! 6 ()))) !ou can specify multiple components of the condition, using the A30 and 7" logical operators. f you want to filter out employees who ma&e less than '(),))) and more than '1)),))), you enter the following condition* %A$A"! 6 ()))) A30 %A$A"! 8 1))))) !ou can also enter a constant for the filter condition. The numeric e9uivalent of FA$%# is /ero :);. Any non4/ero value is the e9uivalent of T"U#. For e.ample, the transformation contains a port named 3U1<#"27F2U3 T% with a numeric datatype. !ou configure a filter condition to return FA$%# if the value of 3U1<#"27F2U3 T% e9uals /ero. 7therwise, the condition returns T"U#. !ou do not need to specify T"U# or FA$%# as values in the e.pression. T"U# and FA$%# are implicit return values from any condition you set. f the filter condition evaluates to 3U$$, the row is treated as FA$%#. %teps to Create a Filter Transformation 1+1 3ote* The filter condition is case sensitive. Filtering "ows with 3ull =alues To filter rows containing null values or spaces, use the %3U$$ and

%2%-AC#% functions to test the value of the port. For e.ample, if you want to filter out rows that contain 3U$$ value in the F "%T23A1# port, use the following condition* F: %3U$$:F "%T23A1#;,FA$%#,T"U#; This condition states that if the F "%T23A1# port is 3U$$, the return value is FA$%# and the row should be discarded. 7therwise, the row passes through to the ne.t transformation. %teps to Create a Filter Transformation Use the following procedure to create a Filter transformation. To create a Filter transformation: 1. n the 1apping 0esigner, open a mapping. 2.Clic& Transformation 6 Create. %elect Filter transformation. (.#nter a name for the transformation. Clic& Create and then clic& 0one. >.%elect and drag all the ports from a source 9ualifier or other transformation to add them to the Filter transformation. +.0ouble4clic& on the title bar and clic& on -orts tab. !ou can also manually create ports within the transformation. ?.Clic& the -roperties tab to configure the filter condition and tracing level. @. n the =alue section of the filter condition, open the #.pression #ditor. A.#nter the filter condition you want to apply. The default condition returns T"U#. Use values from one of the input ports in the transformation as part of this condition. Bowever, you can also use values from output ports in other transformations. ,.#nter an e.pression. Clic& =alidate to verify the synta. of the conditions you entered. 1).%elect the tracing level. 11.Add metadata e.tensions on the 1etadata #.tensions tab. Tips Use the Filter transformation early in the mapping. To ma.imi/e session performance, &eep the Filter transformation as close as possible to the sources in the mapping. "ather than passing rows that you plan to discard through the mapping, you can filter out unwanted data early in the flow of data from sources to targets. Use the %ource Cualifier transformation to filter. The %ource Cualifier transformation provides an alternate way to filter rows. "ather than filtering rows from within a mapping, the %ource Cualifier transformation filters rows when read from a source. The main difference is that the source 9ualifier limits the row set e.tracted from a source, while the Filter transformation

Das könnte Ihnen auch gefallen