AttributeValueMapper
Looks up and assigns attribute values based on other attributes, and stores the looked-up value in a new attribute.
This transformer does not modify feature types.
Input Ports
The feature type that contains the source attribute to be mapped.
Output Ports
Features with the mapped source attribute stored in a new attribute.
Parameters
Attribute Selection
The attribute whose values will be mapped. There is limited support for null, missing, and empty string values. Please refer to the Additional Value Settings section below.
The attribute that will store the looked-up value. You can use the default name, or specify a new attribute name. Alternatively, you can type the name of an existing attribute, or even the Source Attribute. If an existing attribute or the Source Attribute is specified, the existing value of the attribute is overwritten.
The value to give the Destination Attribute if the value of the Source Attribute is not found in the Value Map table. The reverse is true when Mapping Direction is set to Reverse (Destination to Source). There is limited support for null, missing, and empty string values. Please refer to the Additional Value Settings section below.
The default value can be a constant or computed value (such as an attribute value), the value of a user parameter, the value of a system parameter, or an expression containing the above.
You can also enter a default value containing the word KEY (uppercase), where KEY will be substituted by the value of the Source Attribute. If, for example, you have entered a default value of KEY-0 and the Source Attribute has a value d that is not in the mapping table, the destination attribute value will be set to d-0 because KEY is replaced by the original value d.
If left blank and matching values are not found, an empty string is assigned.
Mapping Parameters
Determines whether values will be mapped from the Source Attribute to the Destination Attribute, or vice-versa.
Value Map
This table of values specifies the mapping information.
When the Mapping Direction is set to Forward (Source to Destination), if the value of the Source Attribute is specified in the Source Value column, the Destination Attribute will be created with the value specified in the Destination Value column corresponding to that source value.
This process is reversed if the Mapping Direction is set to Reverse (Destination to Source).
The Source Value and Destination Value can be a constant value or a computed value such as an attribute value, the value of a user parameter, the value of a system parameter, or an expression containing the above.
You can import attribute values (source value, destination value, or both) from any FME-supported source dataset.
The most common use would be to import from the same dataset that is being mapped, but you can also import the mappings from a lookup table stored in a text, CSV or Excel file, or another dataset.
Click the Import button and pick Source Value, Destination Value, or both. A wizard will step you through the import procedure:
- Select the format and dataset to be read. Click Next.
- The next pane displays the list of feature types associated with the dataset. The features in the dataset will be scanned, and the attribute values found will be added to the attribute list in the AttributeValueMapper. Click Next.
- Choose the key attribute. The values of this attribute should match the attribute on features that are entering the AttributeValueMapper. Click Next.
- Choose the value attribute. The values of this attribute will be added to the AttributeValueMapper. Click Next.
- The status will show how many features were scanned, and the overall number of unique attribute values found. Click Import to include the values in the table.
Additional Value Settings
This section contains documentation common to Default Value, Source Value, and Destination Value.
Null: When chosen under Source Value, source null values will be mapped to a destination value. When chosen under Destination Value, the source value will be mapped to a null destination value. The reverse is true when Mapping Direction is set to Reverse (Destination to Source).
Do Nothing: No action will be taken. When mapping in-place, this means the source attribute value will be preserved. Otherwise, this means no destination attribute will be created for the source value specified.
Stop Translation: When the specified source value is encountered, halt translation with the specified message. Useful when you wish to halt translation on unexpected attribute values, such as null values.
When mapping from source to destination, there are three attribute values that are not supported by the Default Value parameter or the Value Map table. They are: missing, null, and empty string values. The exceptions are noted below.
Tip: if you need to map to or from null, missing, or empty string values, consider using NullAttributeMapper.
It is possible to map a source null value, or to map a source value to null, or to specify a default value of null, when the null value is specified as a constant. To specify a null value as the default, source, or destination value, follow this screenshot:
Further, it is possible to map a source value to a destination value of empty string, or to specify the empty string as the default value. Note that if a missing or null value is specified as a destination value or default value via an attribute, it will be converted into an empty string.
Example
This example maps the values "Non-Residential" and "Residential" of the type
attribute to a new attribute, category
, with values "N" and "R", respectively.
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.
Transformer Categories
Transformer History
This transformer was previously named the ValueMapper.
Search FME Knowledge Center
Search for samples and information about this transformer on the FME Knowledge Center.
Tags Keywords: ValueMapper