Shared, Embedded, and Scripted Parameters

Shared and Embedded parameters are not specific types of parameters, instead they refer to two different ways in which parameters might be used.

Scripted parameters are a way to include Python or Tcl code in the way a parameter is defined.

Shared Parameters

There is no limit on the number of times a user parameter can be used or linked to an FME parameter. The value obtained from a user parameter can be used as many times as is required.

When a parameter is used in two or more places it can be described as a shared parameter.

For example, a workspace has a user parameter called TOLERANCE (here being used inside a Generalizer):


However, the workspace author has decided to apply the same parameter in three places in total; two Generalizers and a Snapper:

The advantage is that the same value can be used without the user having to enter it multiple times.


Embedded Parameters

Sometimes in FME, parameter values need to be constructed from multiple components. When one parameter is constructed so as to include the value of another parameter inside it, this is called Embedding Parameters.

For example, here the name of a file is constructed from two user parameters: one is a fixed output path and the other is a user's name:

The technique is called embedding because the user parameters - UserName and OutputFolder - are embedded inside the FME parameter (Target Filename).


Scripted Parameters

Scripted parameters go one step further than an embedded parameter. Instead of simple concatenation, a scripted parameter allows a full Python or Tcl script to be used to construct a value.

For example, this Tcl script creates a filename from a fixed path and an embedded user parameter. However, in this case, the script is used to test whether the workspace is being run on a Windows or Linux system, so it can set the output path accordingly:

set realname ''

if {[string match 'C:*' $FME_MacroValues(FME_HOME)]} {
    set realname 'C:\Output\'+$FME_MacroValues(UserFileName)
} else {
    set realname '/Output/'++$FME_MacroValues(UserFileName)
}

return realname

Note that the script must include a return statement, to return a value to the parameter. A Scripted Parameter is purely for use by an author. The user is not prompted for a value, as it would be absurd to expect them to enter Python code when a workspace runs!


Ms. Analyst says…
Use the ‘print’ command (in Python) or ‘puts’ command (in TCL) to write from the script to the FME log file.

results matching ""

    No results matching ""