Routes features to different output ports depending on the value of an attribute. The set of possible attribute values can be entered manually, or extracted from an input source in the properties dialog.
- Separating features based on attribute values for further individual processing
- Extracting one or more groups of features from a dataset based on attribute values
- Selecting features from a dataset that match specific values and discarding the rest
- Grooming a dataset by keeping select features and discarding features with non-matching, empty, missing, and/or null values
How does it work?
Once connected, the AttributeFilter lets you select an attribute to filter incoming features by. By default, Empty, Missing, Null, and Unfiltered outputs are provided, and you can specify additional values to filter by either entering them manually or importing values from an existing dataset.
All features are passed through the transformer, exiting via the appropriate output port.
In this beginning of a workspace, a CAD file containing road data is read, and the features divided into separate streams for further processing based on the autocad_layer attribute value.
The transformer has been connected to the incoming features from the Reader, and so the dataset’s attributes are available for selection. The autocad_layer attribute is chosen.
The desired values are entered, each on a separate row. The available values could also be determined by using the Import button to scan the contents of the dataset.
- Ideally, you will want to keep the filter list fairly small; otherwise you can end up with a very long list of attributes. If FME determines that the list might be too large, it will return a warning.
- If feature filtering can be done with groups or ranges of values, consider using the TestFilter or AttributeRangeFilter.
- If you are filtering features for the sole purpose of writing to separate layers or datasets, consider using Fanout instead.
This transformer accepts any feature.
|<Empty>||If the feature’s attribute value is an empty string, the feature is output via the <Empty> port.|
|<Missing>||If the feature does not have the specified attribute, it is output via the <Missing> port.|
|<Null>||If the feature’s attribute has a value of null, the feature is output via the <Null> port.|
|<Unfiltered>||If the feature’s attribute has a value not in the list, the feature is output via the <Unfiltered> port. This port can be used for collecting all features with "positive" values, that is, values that are not missing, null, or empty.|
For each value entered in the Possible Attribute Values list, an output port is created with the same name as the value.
|Attribute to Filter by||
When you connect the transformer to the feature type, the list of attributes will appear in a pull-down list. Choose the attribute from the list.
If you know the values you wish to filter, enter them individually here, one per row. Each entry will create an output port.
You may also import values from a source dataset by using the Import button.
Enabled once you have clicked on a row in the Possible Attribute Values list. Choices include:
Note: you may not remove the default values of Empty, Missing, Null, and Unfiltered.
|The import button launches a wizard which will populate the Possible Attribute Values list with a set of values read from a dataset. Select a dataset, the feature type(s) to read from, and the attribute to be scanned for possible values. On completing the wizard, existing values are added to the list.|
Editing Transformer Parameters
Using a set of menu options, transformer parameters can be assigned by referencing other elements in the workspace. More advanced functions, such as an advanced editor and an arithmetic editor, are also available in some transformers. To access a menu of these options, click beside the applicable parameter. For more information, see Transformer Parameter Menu Options.
There are several ways to define a value for use in a Transformer. The simplest is to simply type in a value or string, which can include functions of various types such as attribute references, math and string functions, and workspace parameters. There are a number of tools and shortcuts that can assist in constructing values, generally available from the drop-down context menu adjacent to the value field.
Using the Text Editor
The Text Editor provides a convenient way to construct text strings (including regular expressions) from various data sources, such as attributes, parameters, and constants, where the result is used directly inside a parameter.
Using the Arithmetic Editor
The Arithmetic Editor provides a convenient way to construct math expressions from various data sources, such as attributes, parameters, and feature functions, where the result is used directly inside a parameter.
Set values depending on one or more test conditions that either pass or fail.
Expressions and strings can include a number of functions, characters, parameters, and more - whether entered directly in a parameter or constructed using one of the editors.
|These functions manipulate and format strings.|
|A set of control characters is available in the Text Editor.|
|Math functions are available in both editors.|
|These operators are available in the Arithmetic Editor.|
|These return primarily feature-specific values.|
|FME and workspace-specific parameters may be used.|
|Working with User Parameters||Create your own editable parameters.|
|FME Licensing Level||FME Base Edition and above|
FME Knowledge Center
The FME Knowledge Center is the place for demos, how-tos, articles, FAQs, and more. Get answers to your questions, learn from other users, and suggest, vote, and comment on new features.
Search for all results about the AttributeFilter on the FME Knowledge Center.
Examples may contain information licensed under the Open Government Licence – Vancouver