DefinitionWikipedia defines a loop as "...a sequence of statements which is specified once but which may be carried out several times in succession" - either "a specified number of times... or until some condition is met."
Looping in FMEFME has a loop "transformer" for use in Custom Transformers. Using this technology, a feature entering a custom transformer can be processed using the same set of transformers, a set number of times. Once this feature meets a certain condition, it exits the custom transformer, and the next feature in the pipeline enters.
LimitationsA custom transformer containing a loop permits a single feature to be processed an indeterminate number of times. However, some transformers do not work on the basis of one-feature-at-a-time. These transformers, known as Group-Based Transformers process multiple features at once. A transformer that carries out a geometric overlay is one example of this since, by definition, an overlay function needs to process two or more features at once to have any meaning.
Therefore a loop within a custom transformer is not permitted to contain any transformer that carries out its processing on a group basis. The only permitted transformers are those that process on a feature-by-feature basis. These are known as Feature-Based Transformers.
Defining in WorkbenchIn Workbench a loop repeats a section between a loop placemarker, and a standard custom transformer input port. Right-click on the canvas and choose 'Insert Transformer Loop'. A dialog opens asking which input port you wish to loop to. On selecting the appropriate port a loop transformer is placed containing the annotation 'Loop to xxxx' (where xxxx is the input port chosen). To define an input port as being used as a loop entry point only, and not as an entry point for features from outside the custom transformer, right-click the input port and remove the checkmark from the setting 'published'.
Above: A section of custom transformer containing a loop. In this case a feature passes through the loop whilst a certain condition is not met. This condition is defined by the Tester transformer. This example is slightly unusual in that the feature being looped does not exit the loop on meeting the test condition, but is instead thrown away (indicated by the unused PASSED port on the Tester). Output features are actually derived from a duplicate connection on the ExpressionEvaluator - hence there will be a separate output feature for each iteration of the loop.
Loopy ArtThe usefulness to the FME Art movement of repeating a function again and again is shown by this page of Loopy Artwork.
Suggested Similar Articles
Looping within a custom transformer is a perfect tool for making FME Art.
Notes of the use of Published Parameters within workspace - particularly within custom transformers.
A review of how custom transformers work on FME Server.
Samples using the MapTextLabeller and MapTextStyler transformers to produce aesthetically pleasing cartographic output in FME 2013
The custom transformer PointDisperser disperses points with the same location around their common center within a range of distances distributing them at regularly increasing angles.