Creating a Linked Custom Transformer

All custom transformers start out with an embedded definition. To create an external definition, the custom transformer is exported using the Export as Custom Transformer option on the menubar:

At this point a dialog opens in which you can confirm the transformer name and category, plus some other parameters including the save location:

Name and category are fairly obvious, so let's look at some of the other different options...

Insert Mode

We know that the definition of a custom transformer can be stored either in a workspace (embedded) or in a separate file (linked). Therefore each instance of a custom transformer points to either an embedded or linked definition.

But it's important to know that each instance can change their definition source. For example, an instance of a custom transformer linked to a file definition, can be switched to embedded (in which case the external definition gets embedded into the workspace).

Likewise, an instance that points to an embedded definition, can be switched to point to an external file.

When I am the author of a custom transformer I might want to control the initial state when an instance is placed for the first time. This is what the Insert Mode parameter does.

There are four different modes:

Let's say I export my custom transformer with Insert Mode set to one of the Embedded choices. The definition is now stored inside an fmx file and FME will recognize it as an available transformer. But when a user places a new instance to their workspace (say with Quick Add or the Transformer Gallery), the definition of the custom transformer is copied from the fmx file and embedded into the workspace.

If I choose Embedded By Default, it means that although each instance of the transformer starts as Embedded, the user can switch the instance to "Linked" at any point.

If I choose Embedded Always it means that each instance of the transformer starts as embedded, and must stay that way. It cannot be switched to Linked at a later point.

Similarly, I could export my custom transformer in Linked mode. When a user places a new instance the definition of the transformer remains in my fmx file, with the instance linked to it.

If I choose Linked By Default, each instance of the transformer starts as Linked, but can be switched to Embedded at any time.

If I choose Linked Always, each instance starts as Linked, and stays that way. To cannot be switched to Embedded at a later point.


FME Lizard says…
Insert Mode is an important parameter when I am the author of a custom transformer, who has created it for other workspace authors to use. It gives me control over how they will use that transformer.

Which Mode to Use

Embedded Always is a good choice when the person using the transformer is less experienced with FME; it's easier for them to manage and if they make changes they won't affect other people. Embedded is also a good choice where the custom transformer is intended for use by individuals (i.e. not sharing it as a group).

Linked Always is a good choice when the custom transformer is intended to be shared among a group of users. Because it is linked, the users will always receive updates if the transformer definition is changed, and because the definition is shared, it becomes a standard that is applied to all users.

Only when the end-user is experienced in FME and can understand the consequences, is it advisable to use a “By Default” setting and allow type switching.

Password

The password field allows you to password-protect the custom transformer. This makes it impervious to edits from unauthorized persons. Additionally, the file contents are (very mildly) encrypted so that they cannot be copied by opening the source file in a text editor.

This allows authors to make transformers available for purchase without any fear that their work will be copied or edited. Of course, it’s important not to forget or lose the password yourself, in case you wish to make edits!

Save Location

FME has a specific installation folder in which custom transformer files can be saved. If a custom transformer is saved in this folder, then it becomes available in Workbench and can be used the same as any other transformer. If it is saved elsewhere then FME won't be able to find it unless that path is set under Tools > FME Options > Default Paths.


Editing a Linked Custom Transformer

When you click the OK button on the Export as Custom Transformer dialog, the transformer is exported to a separate (.fmx) file. That file is immediately opened inside a new instance of FME Workbench, for you to make edits.

In essence editing a custom transformer works the same way as editing a workspace: you open the file in FME Workbench and make edits as required.

The important part to remember is that each instance of the Custom Transformer that is linked to this file, will be affected by any changes that you make.


FME Lizard says…
It’s best to hunt for bugs in a custom transformer when its definition is embedded, before exporting it. That's because tools such as Feature Caching and Run with Breakpoints do not work inside exported transformers.

FME Lizard asks...

Q) Here is a question for you to investigate: Can you nest custom transformers? That is, can you put one custom transformer inside another?

Yes, with no restrictions
Yes, but you can only nest transformers of the same type (Linked or Embedded)
Yes, but you cannot nest Linked Custom Transformers
Yes, but only a single level of nesting

A) You can embed any type of custom transformer inside any other type of custom transformer, to multiple levels of nesting.

results matching ""

    No results matching ""