Creating and Setting Attributes
Creating attributes and setting a value are probably the primary attribute function used within FME. When an attribute is created its value can be set in any one of a number of ways.
The transformers capable of creating an attribute - and setting its value - are:
- AttributeCreator
- AttributeManager
The AttributeCopier and AttributeRenamer transformers can set an attribute value, but only if it exists already.
The AttributeManager
For most operations we'll concentrate on the AttributeManager, so here is a quick overview of that transformer.
The AttributeManager parameters dialog has a number of fields: Input Attribute, Output Attribute, Attribute Value, and Action. Uniquely among attribute-handling transformers, it is automatically filled in with the details of the attributes connected to it:
The action field can be set by the user, but is also set automatically when a change is made to the other fields.
Manually Create an Attribute
By entering a new attribute name into the Output Attribute field, it will be created in the output.
The text <Add new Attribute> highlights where a new attribute can be created. By default, when the Attribute Value field is empty, a new attribute has no value.
Set a fixed Attribute Value
A fixed (or constant) value for an attribute can be created by simply entering a value into the Attribute Value field:
Here, for example, a new attribute called City is being given a fixed value of Vancouver.
However, also note that the existing attribute NeighborhoodName is also being assigned a fixed value. It is being given the value "Kitsilano". Notice how by entering a value into that field, the Action field has automatically changed from "Do Nothing" to "Set Value".
Besides entering set values like this, it's possible to construct an attribute value in a number of different ways.