Exercise 3.2b | Locating Transformers |
Data | 3-1-1 case location details (XLS hosted on FTP) |
Overall Goal | Find a transformer to fix inconsistent data |
Demonstrates | Using Transformer Gallery and Quick Add |
Start Workspace | C:\FMEData2018\Workspaces\IntroToDesktop\Ex3.2-Begin.fmw |
End Workspace | C:\FMEData2018\Workspaces\IntroToDesktop\Ex3.2-Complete.fmw |
Did you find a transformer that worked?
Answer
We can fix this problem with a single transformer: the AttributeValueMapper. Here is the description from the FME Documentation:
Compares attribute values to a lookup table and assigns new values where matches are found. Mapped values may be stored in a new attribute, or overwrite an existing attribute, including the original source.
Other Solutions
Don't worry if you didn't find this specific transformer. Hopefully the exercise of looking for it still showed you the paths you can use to find the right transformer.
You might have found another way to solve this problem; there are often multiple ways to solve a problem in FME. Here are a few possibilities:
- An AttributeManager with Conditional Values
- An AttributeCreator with Conditional Values
- A TestFilter and AttributeCreators
- Testers and AttributeCreators
- AttributeValidators and AttributeCreators
- Two consecutive StringReplacers
Did you find another way? Congratulations! Please let us know at [email protected] and we'll add it to this list.
Here's how to correctly use the AttributeValueMapper.
1) Start Workbench
Start Workbench (if necessary) and open the workspace from Exercise 3.1. Alternatively you can open C:\FMEData2018\Workspaces\IntroToDesktop\Ex3.2-Begin.fmw.
2) Add an AttributeValueMapper
Add an AttributeValueMapper to the canvas between the AttributeManager and the writer feature type.
Once it is added, double-click it to open its parameters. This transformer allows you to supply a series of Source Values and Destination Values. The source values in the incoming data are replaced by any matching destination values, or otherwise receive a default value. Fill in the parameters like this:
Parameter | Value |
---|---|
Source Attribute | Local Area (select from Attribute drop-down) |
Destination Attribute | Local Area (type in manually) |
Default Value | Local Area (select from Attribute drop-down) |
Mapping Direction | Forward (Source to Destination) |
Source Value | Destination Value |
---|---|
Arbutus Ridge | Arbutus-Ridge |
Dunbar Southlands | Dunbar-Southlands |
We will replace any values with a space to those with a dash - this fits the City of Vancouver specification.
Note that by providing an attribute to Default Value, if Local Area
for a feature doesn't equal one of the Source Values, it will simply keep the value it already had.
Your dialog should look like this:
CONGRATULATIONS |
By completing this exercise, you have learned how to:
|