StringConcatenator
From fmepedia
Concatenator is a Workbench Transformer.
| Table of contents |
Description
A Concatenator transformer joins together (concatenates (http://en.wikipedia.org/wiki/Concatenation)) attributes on a feature. It also permits 'constant' values to be included. Constants (http://en.wikipedia.org/wiki/Constant) are user defined characters or strings that are the same for every feature.
For example...
Address1 Suite 2017 Address2 7445-132nd Street City Surrey Province British Columbia PostCode V3W 1J8 Constant1 , Address = Address1+Constant1+Address2+Constant1+City+Constant1+Province+Constant1+PostCode Address = Suite 2017,7445-132nd Street,Surrey,British Columbia,V3W 1J8
Related transformers are the ListConcatenator and the CoordinateConcatenator.
Example
The attached workspace shows an example use of the Concatenator transformer.
This workspace requires the FME Sample Dataset (http://www.safe.com/support/onlinelearning/fmesampledata.php) to be installed for it to run correctly.
Scenario
The Concatenator transformer is a natural complement to FME's fanout functionality, as it provides a way by which to fan out by more than one attribute simultaneously.
An FME user has a set of zoning data covering the entire city of Interopolis, and a dataset containing a set of grid squares.

Above: The source data: city grid overlaid on zone data
The user wishes to both tile the zoning data into grid squares and subdivide it up into one Shape file per zone type.
- Tiling the data with a Clipper transformer and fanning it out on the grid square ID (Square1, Square2, etc) is simple:

Above: The zoning data fanned out by city grid
- Fanning out by the zone type (Commercial, Industrial, etc) is also easy enough:

Above: The zoning data fanned out by zone type
- However, to do both fanouts at once requires the grid square ID and zone type attributes to be concatenated together into a new attribute:
Square1-Commercial.shp Square1-Industrial.shp Square1-Residential.shp Square2-Commercial.shp Square2-Industrial.shp etc
Workspace Description

Above: The workspace
In this workspace:
- The source datasets are passed into a Clipper transformer; city grid as the clipper, zoning data as the clippee.
- The zoning data is clipped by the grid features and output with the grid square ID attached.
- The grid square ID and zone type attributes are concatenated together to form a new attribute "_fanoutAttribute".
- The destination feature type has a fanout applied using the attribute "_fanoutAttribute"
Notes
- The StringReplacer transformer replaces all instances of the "/" character in zone names. This would cause a problem in the fanout because it would form an invalid file name.
- The City Grid dataset is read first (uppermost in the Navigator pane). This allows the Clipper to be run in the more efficient "Clippers First" mode.
Output

Above: The output. The L28 (L29, etc) part is the grid square ID. The LI (RR, SF, etc) part is the zone type.
