You are here: FME Workbench > Custom Transformers > Looping Custom Transformers

Looping Custom Transformers

Looping a custom transformer is useful for users who want 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.

To set up looping with group-based (or blocking) transformers, see Looping with a Blocking Transformer.

Steps

  1. Create a Custom Transformer in an existing workspace. You might want to include "Loop" in the name.
  2. Include the transformers that will make up the conditions of the loop.
  1. Right-click in the workspace and choose Insert Transformer Loop, or select the menu Insert > Transformer Loop.
  1. Choose the INPUT to loop to (if there's more than one). The following icon appears on the canvas:

  1. 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.

Usage Notes

Disabling Published Input

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.