Looping a custom transformer is useful for users who want to to leverage existing transformers (Testers, Filters, etc) to determine end conditions.
For example, instead of rerunning a workspace many times and resetting transformer properties, you can set a transformer to "loop" until the conditions are met. This means that any features that enter the transformer will be sent back to its given input if the conditions don't yet match.
These transformers also work well if you want create values for the fme_color (or fme_fill_color) attribute, which would spread color evenly from dark to light independently on the number of input features.
Limitations:
Looping transformer inputs are based on transformers specific to the workspace you are in.
You can't use transformers that must process all features before returning a result (for example, a Sorter). These are sometimes referred to as "blocking transformers."
Steps
Create a Custom Transformer in an existing workspace. You might want to include "Loop" in the name.
Include the transformers that will make up the conditions of the loop. In our example, we want to generalize waterlines, so we will use a CoordinateCounter, a Tester and a LineGeneralizer.
Right-click in the workspace and choose Insert Transformer Loop.
Choose the INPUT to loop to (if there's more than one). The following icon appears on the canvas:
Place the transformer in the main workspace and run the workspace. When the looping transformer reaches the preset parameters in the custom transformer properties, the translation will complete.
Tips:
|
When you want to set a number of iterations as a transformer's parameter, you might want to connect the Loop to another input port. In this case, this input port should not receive any external input features. To do this, right-click on the applicable port in the Navigator pane, and uncheck the Publish option. In this example, the NOINPUT input port should not receive any features.