FME Transformers: 2024.1
FME Transformers: 2024.1
AttributeManager
Alters one or more attributes by adding, renaming, copying, deleting or re-ordering. Sets values for new, existing, and modified attributes to any combination of constants, attribute values, conditionals, expressions, and parameters. Values can reference adjacent features.
Typical Uses
- Create a new attribute, and set default or new values for it in a variety of ways
- Modify existing attributes by renaming, and deleting them, and set or clear values for them
- Re-order attributes
- Set an attribute value based on features that come before or after the current feature
- Simplify a workspace by consolidating multiple attribute-manipulating transformers into one place
How does it work?
Attributes of the input features are presented in a matrix of rows and columns, where you can perform multiple tasks, including:
-
Creating, renaming, or deleting attributes
-
Setting values and default values
-
Specifying schema data types
All features that pass through the AttributeManager are modified according to the selections made in the parameters.
Importing Attributes and Data Types
Using the Import button, attribute names and/or data types may be imported from existing datasets or upstream feature caches (if enabled and current).
The results of the import will either be added to or update the Attribute Actions table, and may be further revised. These changes are not permanent until the OK button is clicked.
To discard changes made by an import, use the Cancel button to exit the parameters dialog.
Filtering Attributes
When working with features that have many attributes, it may be convenient to reduce the number displayed. This can be done with the Filter and Regex Filter options in the table controls.
Note that using either filter option will not result in attributes being removed from the features - they are only hidden from display.
Exposing Attributes
Unexposed attributes may be made visible by adding their names in the Input Attribute column of the Attribute Actions table, in a new row. Attribute names added here are not tested for validity.
Exposing attributes makes them visible in FME Workbench so they can be used elsewhere in the workspace, which is useful if you know features have an attribute, but it is not currently showing as available in your workspace. For example:
- FME Attributes (fme_) and format-specific attributes that are not automatically shown in FME Workbench.
- Features output from transformers like the SchemaMapper that dynamically add attributes onto features which FME Workbench is not aware of.
Examples
Example: Adding and modifying attributes and values
In this example, several attributes of the input features are modified:
- GlobalID is renamed, changing the case of the attribute name.
- An unwanted attribute, REPRESENT, is removed.
- X and Y attributes are created and values are assigned by extracting geometry with an FME function
- UPDATEDBY is created and set to the fixed value Smith.
- All other attributes pass through untouched.
The altered attributes are reflected in the transformer.
Advanced Example: Using Multiple Feature Attribute Support
Adjacent Feature Attributes are accessed under Advanced: Attribute Value Handling. When turned on, you can specify a number of features preceding and following the current feature to reference in calculating new values.
Suppose we are given the dataset below:
ID |
Latitude |
Longitude |
---|---|---|
0 |
49.1640 |
-123.061 |
1 |
49.1643 |
-123.063 |
2 |
49.1642 |
-123.062 |
3 |
49.1642 |
-123.064 |
If the Number of Prior Features and Number of Subsequent Features parameters are both set to 2, then when the first feature is read, the AttributeManager has access to the following features:
Feature Reference |
ID |
Latitude |
Longitude |
---|---|---|---|
feature[-2] |
<missing> |
<missing> |
<missing> |
feature[-1] |
<missing> |
<missing> |
<missing> |
current feature |
0 |
49.1640 |
-123.061 |
feature[+1] |
1 |
49.1643 |
-123.063 |
feature[+2] |
2 |
49.1642 |
-123.062 |
Note that some attributes are missing because no features exist prior to the first feature.
After the second feature is read, the window of prior and subsequent features available to AttributeManager shifts to produce the following:
Feature Reference |
ID |
Latitude |
Longitude |
---|---|---|---|
feature[-2] |
<missing> |
<missing> |
<missing> |
feature[-1] |
0 |
49.1640 |
-123.061 |
current feature |
1 |
49.1643 |
-123.063 |
feature[+1] |
2 |
49.1642 |
-123.062 |
feature[+2] |
3 |
49.1642 |
-123.064 |
This statement would calculate the average latitude of the two preceding features:
Calculations referencing adjacent features can be created in the Arithmetic Editor and the Text Editor. These editors will list the attributes of the currently processed feature first, then the prior features, then the subsequent features.
Configuration
Input Ports
Input
This transformer accepts any feature.
Output Ports
Output
Features with attributes modified according to parameter selections.
Parameters
Advanced: Attribute Value Handling
Substitute Missing, Null, and Empty by |
Specifies the desired behavior when the referenced attribute does not exist, has a null value, or has an empty string value. Such attributes can be thought of as unresolved attributes. For example, since there are no features prior to the first input feature, the AttributeManager will fail to resolve the value of feature[-1].AttrName for the first input feature. If this parameter is set to No Substitution, the AttributeManager will resolve all unresolved attributes with an empty string if they are used in a larger expression. If the unresolved attribute is assigned directly and is not part of a larger expression, then the Output Attribute will be unresolved in the same way. For example, if B is missing, and A is set to @Value(B), then A will be missing as well. But if A is set to "B = @Value(B)", A will have the value of "B = ". As another example, if the value of feature[+2] is the empty string and Default Value is specified, then the empty string will be treated as an unresolved attribute, and will be resolved as the value specified under Default Value. If this parameter is set to Closest Adjacent Feature, then the unresolved attributes will be resolved as the corresponding attribute of the closest feature, if such a feature exists. When looking for closest features, features with unresolved attributes are skipped. If a prior or subsequent feature has unresolved attributes, it is possible that the current feature is used to resolve the missing attributes. For example, if the value of feature[-2].AttrName is unresolved, then to resolve the value of feature[-2].AttrName the AttributeManager will look at the closest features to feature[-2], alternating between features prior to and subsequent to feature[-2]. It will first look at feature[-3].AttrName, followed by feature[-1].AttrName if needed, and then feature[-4].AttrName if needed, until all prior and subsequent features specified have been exhausted. If the attribute remains unresolved within the specified prior and subsequent features, then it will be resolved as the value specified in the Default Value parameter. |
Default Value |
This parameter specifies the value used to resolve unresolved attributes in these cases:
|
Enable Adjacent Feature Attributes
When enabled, you may set an attribute value (in the Attribute Actions table) based on the attributes of features prior or subsequent to the current feature by referencing them as follows:
- Attributes of prior features are referenced as feature[-1].AttrName, feature[-2].AttrName, and so forth.
- Attributes of subsequent features are referenced as feature[+1].AttrName, feature[+2].AttrName, and so forth.
- Attributes of the currently processed feature are accessed directly without a prefix, such as AttrName.
When retrieving the value of a prior feature, any changes made by the AttributeManager to that feature will take effect.
Number of Prior Features |
This parameter specifies the maximum number of prior features that can be referenced by the AttributeManager. If Multiple Feature Attribute Support is enabled, this must be a value from 0 to 100. As additional features must be read for each feature processed, defining only the maximum number of features needed to be retrieved will improve performance. |
Number of Subsequent Features |
This parameter specifies the maximum number of subsequent features that can be referenced by the AttributeManager. If Multiple Feature Attribute Support is enabled, this must be a value from 0 to 100. As additional features must be read for each feature processed, defining only the maximum number of features needed to be retrieved will improve performance. |
Attribute Actions
When an AttributeManager transformer is connected and opened for the first time, this matrix is automatically populated with the incoming features’ attributes as they currently exist. It will also adjust dynamically to reflect upstream attribute changes in the workspace.
By default, the Actions are set to “Do Nothing” and pass through the features unaltered. As you make changes to individual items, FME interprets the appropriate Action based on your inputs. Action can be overridden manually, but you generally should not need to adjust it.
Input Attribute |
When the transformer is first opened this column is populated with the full list of exposed attributes sent to the input port. This field is not editable, but will update to reflect changes made in the workspace. When new attributes are created this field will remain blank. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Output Attribute |
By default, the Output Attribute matches the Input Attribute. You can:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Value |
By default, Value is blank, leaving the features unchanged. You can set new values here by clicking in the appropriate row and:
See Defining Values below for detailed information on using these options. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Type |
Specify the attribute's data type. The ellipses button will open an Attribute Type Definition dialog, which can assist with setting Type, Width, and Precision (where necessary). Setting Type does not require an Action. The attribute is tagged with the specified Type information, but type limitations are not enforced on values at this point, and so mismatches between type and value are possible. Type may be enforced elsewhere in the workspace, such as in writers or by using an AttributeValidator or Tester to check values against type. Available data types include:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Action
|
By default, Action is set to Do Nothing, leaving features unchanged. As you make changes in the parameters, the Action will adjust automatically to reflect the appropriate result, which can be manually overridden in some cases. The available actions are: Set Value: Sets the attribute to the value specified in the Attribute Value column. Overwrites existing attribute values. Do Nothing: Leaves the attribute unaltered. Rename: Renames the input attribute to the name specified in the Output Attribute column. Remove: Deletes the attribute entirely and removes it from the output schema. Set Default Value: Assigns the specified value for the attribute to features where the attribute is missing. Does not overwrite current values, including null. NOTE:
|
Table Tools
Filter
|
Reduce the number of table rows displayed using alphanumeric matching or regex expressions: Filter will display only those attributes with any column in the Attribute Actions table containing the characters entered, and is not case-sensitive. Regex Filter will display only those attributes with any column in the Attribute Actions table matching a regular expression - which may be as simple as a specific series of characters, or as complex as you like, using Advanced Regular Expression syntax. When Regex Filter is selected, the ellipsis button will access the Regular Expression Editor which includes a syntax reference and expression testing. Matching is not case-sensitive. |
Import |
Import attribute names and/or data types from existing datasets or feature caches. |
|
Clean up the Attribute Actions table by removing invalid rows or resetting the table completely to match the input features. |
Editing Transformer Parameters
Transformer parameters can be set by directly entering values, using expressions, or referencing other elements in the workspace such as attribute values or user parameters. Various editors and context menus are available to assist. To see what is available, click beside the applicable parameter.
How to Set Parameter Values
Defining Values
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.
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.
Conditional Values
Set values depending on one or more test conditions that either pass or fail.
Parameter Condition Definition Dialog
Content
Expressions and strings can include a number of functions, characters, parameters, and more.
When setting values - whether entered directly in a parameter or constructed using one of the editors - strings and expressions containing String, Math, Date/Time or FME Feature Functions will have those functions evaluated. Therefore, the names of these functions (in the form @<function_name>) should not be used as literal string values.
Content Types
These functions manipulate and format strings. | |
Special Characters |
A set of control characters is available in the Text Editor. |
Math functions are available in both editors. | |
Date/Time Functions | Date and time functions are available in the Text Editor. |
These operators are available in the Arithmetic Editor. | |
These return primarily feature-specific values. | |
FME and workspace-specific parameters may be used. | |
Creating and Modifying User Parameters | Create your own editable parameters. |
Dialog Options - Tables
Table Tools
Transformers with table-style parameters have additional tools for populating and manipulating values.
Row Reordering
|
Enabled once you have clicked on a row item. Choices include:
|
Cut, Copy, and Paste
|
Enabled once you have clicked on a row item. Choices include:
Cut, copy, and paste may be used within a transformer, or between transformers. |
Filter
|
Start typing a string, and the matrix will only display rows matching those characters. Searches all columns. This only affects the display of attributes within the transformer - it does not alter which attributes are output. |
Import
|
Import populates the table with a set of new attributes read from a dataset. Specific application varies between transformers. |
Reset/Refresh
|
Generally resets the table to its initial state, and may provide additional options to remove invalid entries. Behavior varies between transformers. |
Note: Not all tools are available in all transformers.
For more information, see Transformer Parameter Menu Options.
Reference
Processing Behavior |
Feature-Based
|
Feature Holding |
No |
Dependencies | None |
Aliases | |
History | Released: FME 2016.0 |
FME Community
The FME Community 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 AttributeManager on the FME Community.
Examples may contain information licensed under the Open Government Licence – Vancouver, Open Government Licence - British Columbia, and/or Open Government Licence – Canada.