FME Form: 2024.2
Working with User Parameters
User parameters are parameters that you expose in the workspace. This is useful if you want to set visible default values, or if you want to be able to easily change a parameter from workspace to workspace.
You can create user parameters to set many different types of data, such as references to datasets, attributes, coordinate systems, grid shift files, geometries, database and web connections, text, numbers, dates, and others.
Parameter Type | Creates a Parameter to... |
---|---|
Choice | Choose one or more values. |
Color | Select a color value. |
Datetime | Enter a date and time. For information about output formats, see Standard FME Date and Time Format. |
File/URL | Choose the names and paths of existing files or folders, an output file or folder, or a URL. |
Message | Display a message at runtime. |
Number | Enter an integer or floating-point number. The number can be bounded or unbounded based on the specified Configuration. |
Password | Enter a password. |
Text | Enter a text string. |
Yes/No | Select or unselect a checkbox. |
Attribute Name | Choose names of feature type attributes, or items from a comma-delimited or space-delimited attribute list. Choices only populate in the context of a reference to the user parameter in the workspace, such as when the Attributes parameter of a StringReplacer transformer references an Attribute Name user parameter. |
Coordinate System | Choose a coordinate system. |
Database Connection | Choose a database connection. |
Geometry | Enter a geometry as a set of spatial coordinates in GeoJSON. When a workspace containing a Geometry published parameter is run from FME Flow, an interface is available for displaying the specified coordinates on a map and specifying the desired geometry. For more information, see Using the Geometry Parameter in FME Flow (previously FME Server). Tip To handle the JSON data returned by this parameter: Use a GeometryReplacer transformer to turn the parameter value into a real geometry. Specify GeoJSON as the GeometryEncoding. Use a JSONExtractor transformer to extract the coordinate values. For example, to extract X/Y coordinate values to a point feature, specify json["coordinates"][0] and json["coordinates"][1]. |
Reprojection File | Choose a grid shift file for reprojecting data. |
Web Connection | Choose a web connection. |
Scripted | Write a Python script that assigns the value of a parameter to the workspace at runtime. |
Published or Private Parameter?
There are two main kinds of user parameters: Published and Private.
Published Parameters
When you define Published Parameters, you can choose to be prompted for information that might change when the workspace is run. This makes the workspace more portable.
You can also control the visibility of published parameters depending on the values of other parameters that are specified previously in the prompt.
Published Parameters display in the log file as they would appear on the command line, which allows for simpler migration of workspaces to a command-based environment.
For more information, see Running a Workspace with Published Parameters.
Private Parameters
Private Parameters are used internally, mainly to share a parameter value across multiple transformers. For example, multiple SchemaMappers may reference a single parameter for its schema mapping table dataset. You can also create parameters for username/password fields in commonly accessed database tables.
Private Parameters are nearly identical to Published Parameters, but they have the following differences:
- Prompt-and-run does not prompt for Private Parameter values.
- The command line, at the top of the translation log and
.fmw
file, does not show the command line argument to set Private Parameters. (However, since they are macros in the mapping file, you can still modify them.)
Creating User Parameters
When you create a user parameter, you specify the type of parameter, whether it is published or private, and all of its other properties. For more information, see Creating and Modifying User Parameters.
Using Parameters
Once you create a user parameter, you can use it in several ways:
- Right-click on the parameter and select Duplicate to create another parameter with similar settings, and edit as desired.
- Right-click on the parameter and select Copy. To reuse the parameter in another workspace, right-click in the canvas and select Paste. The parameter is applied to the new workspace, along with any other parameters it references.
- Right-click on the parameter and select Apply To to apply that parameter to another setting in the workspace.
- Use the ParameterFetcher transformer with the parameter name specified.
Examples
The FME Community includes additional information and examples of published parameters.