Beruflich Dokumente
Kultur Dokumente
Transformation type:
Active
Connected
A filter condition returns TRUE or FALSE for each row that the Integration
Service evaluates, depending on whether a row meets the specified condition.
For each row that returns TRUE, the Integration Services pass through the
transformation. For each row that returns FALSE, the Integration Service 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 make salaries of $30,000 or higher.
Tip: Place the Filter transformation as close to the sources in the mapping as
possible to maximize session performance. Rather 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 Condition
Any expression that returns a single value can be used as a filter. For example, if
you want to filter out rows for employees whose salary is less than $30,000, you
enter the following condition:
You can also enter a constant for the filter condition. The numeric equivalent of
FALSE is zero (0). Any non-zero value is the equivalent of TRUE. For example,
the transformation contains a port named NUMBER_OF_UNITS with a numeric
datatype. You configure a filter condition to return FALSE if the value of
NUMBER_OF_UNITS equals zero. Otherwise, the condition returns TRUE.
You do not need to specify TRUE or FALSE as values in the expression. TRUE
and FALSE are implicit return values from any condition you set. If the filter
condition evaluates to NULL, the row is treated as FALSE.
To filter rows containing null values or spaces, use the ISNULL and IS_SPACES
functions to test the value of the port. For example, if you want to filter out rows
that contain NULL value in the FIRST_NAME port, use the following condition:
IIF(ISNULL(FIRST_NAME),FALSE,TRUE)
This condition states that if the FIRST_NAME port is NULL, the return value is
FALSE and the row should be discarded. Otherwise, the row passes through to
the next transformation.
Tips
However, the Source Qualifier transformation only lets you filter rows from
relational sources, while the Filter transformation filters rows from any type of
source. Also, note that since it runs in the database, you must make sure that the
filter condition in the Source Qualifier transformation only uses standard SQL.
The Filter transformation can define a condition using any statement or
transformation function that returns either a TRUE or FALSE value.