Define New Transformer with Tcl Commands

This message appears in the splash window of FME Workbench: "Loading Transformers..."

FME Transformers are defined in "*.fmx" files; the Workbench is loading the definitions from the files saved in these folders.
<FME HOME>\transformes
2014-10-12: And also here, if there are transformers downloaded from the FME Store.
C:\Users\<username>\AppData\Roaming\Safe Software\FME\FME Store\Transformers

If you define a transformer with the correct syntax and save it to one of these folders as "*.fmx" file, it will be added to the Transformer Gallery after restarting Workbench.
Alternatively, click the "refresh" button of Transformer Gallery to reload transformer definitions. It was pointed out by Dale@Safe. See also his comment.
There are several ways to define a transformer. Although I don't know everything, I recently learned about a way to define a feature-based transformer using Tcl commands.
A Tcl-based transformer can be defined with a text editor such as Notepad.

Example: AttributeMultiplier Version 0

Download "AttributeMultiplier_v0.fmx", save it to one of the folders mentioned above, and restart Workbench (or click the "refresh" button of Transformer Gallery). Then the transformer will be added to the Transformer Gallery.
This transformer multiplies every specified attribute by a value that you specified to the "Multiplier" parameter. If the original attribute value is non-numeric, this transformer does nothing against the attribute. i.e. leaves the original value.

Open the fmx file with a text editor to see the definition. And see these documentations to learn more about the syntax.
Transformer Definition Documentation
FME GUI Type Documentation
TclCaller (FME Tcl Variables and Functions)

You can also see the definitions of existing transformers in this file as good examples.
But be careful not to destroy it. I cannot support you to restore the file ;)
<FME HOME>\transformes\fmesuite.fmx

Example: AttributeMultiplier Version 1

Upgrade is easy. Just create new definition with new version number which is greater than the previous one. You can write the new definition in either the same file or another new file.
2014-09-29: I found that two same transformer names appear in the Transformer Gallery when two files exist for two versions simultaneously, although both of them refer to the new version. So, it seems better to insert the new definition before the old definition in the same file if you need to retain the old version after upgrading.
The version 1 example is here: "AttributeMultiplier_v1.fmx"
In the version 1, you can choose one of these actions which should be performed against non-numeric attributes.
- Do nothing
- Replace with a value that you specified to the "New Value" parameter
- Replace with an empty string
- Replace with <null>

To uninstall the transformer, just remove the fmx file.

FME 2014 SP3 build 14391

P.S. I wanted to create a transformer that will hide specified attributes/lists. The functionality should be same as "Attributes to Hide" and "Lists to Hide" in the PythonCaller. Lists were able to be hidden, but I have not achieved a way to hide attributes yet. It seems not to be easy...


  1. Hi Takashi, Congratulations on discovering another part of the FME puzzle. While we don't necessarily encourage folks to write their own transformers by hand like this, it is certainly helpful to know how they work underneath. One point -- there is a "refresh" button on the transformer gallery that can be used to reread all the definitions, so you don't need to restart. Another helpful trick while you're developing a transformer -- make your edits to your .fmx, refresh, delete from your canvas the instance you'd placed, and then control-Z to undo. You'll have a the transformer back with the new definition and the parameters you'd set before.

    Lastly, removing attributes is actually something that can't be easily done via .fmx files -- for that we have special code in workbench itself, so you are correct that it can't be done as easily as adding.

    1. Hi Dale, thanks for the comments.
      Oh, yes. I confirmed that the the "refresh" button works to reload all the transformer definitions.
      It's very rare indeed that we have to define a transformer with such a handmade way. But exploring "fmesuite.fmx" sometimes gives me a knowledge that is not documented. For example, I found why some transformers do not work for an attribute that contains commas in its name. If I know the reason, I can avoid unexpected behaviors beforehand.
      And I've understood that hiding attributes is not easy. In the interim, I will use the PythonCaller if I want to hide attributes in a workspace. Thanks again.