ListRenamer
Renames or promotes list names or components. When promoting or renaming, if the resulting name collides with an existing attribute name, the existing attribute will be overwritten.
For the discussion below the following terms are introduced:
- Component – This is a piece of an attribute name. For example, in list{}.blat{}.foo, there are 3 components. Two components are lists: list{} and blat{}. One component is not a list: foo.
- Subcomponent – This is a component of a list. Thus, in list{}.blat{}.foo, blat{} is a subcomponent of list{}. Similarly, foo is a subcomponent of blat{}.
- Structured List – a list for which a subcomponent contains more than one piece of data. The elements of the structure are represented as foo{}.a or foo{}.b.
Parameters
The selected list and list components that will be renamed or promoted. Selecting a list will cause the table to populate with the components available for renaming.
Changing the List to Process will cause the List Action to switch to Rename.
The action to perform on the list.
- Rename means the components in the selected name will be renamed only. The components of the selected list will be listed in the ‘List Component Name’ column of the List Components To Rename table. The ‘New Name’ will default to the old one.
-
Promote means the last component of the List to Process will be promoted. It will no longer be a subcomponent of the list but a ‘sibling component’.
If the last component is not a list, that item will become a list at the same level as its parent list.
If the last component of the List To Process is a list, then the user will be prompted to select a list index to promote. When promoting a specific element within a list, the behavior will depend on whether the list is structured (ie. List{}.bar{}.a). If it is structured, then the subcomponents will become subcomponents of the parent. If the list is unstructured (ie. List{}.bar{}.foo{}), then the list name will become a component at the same level as the parent list (ie. List{}.foo).
If this option is selected, the List Components to Rename will be populated with the components of the List to Process up until the last component.
-
Promote All Subcomponents means that all subcomponents of the selected list will be promoted. This option is only available if none of the subcomponents are lists. Each subcomponent will become a list at the same level as the parent list.
If this option is selected, the List Components to Rename will give the list of the subcomponents of the List to Process.
When promoting list components, the promoted components will receive the index of their parent. As a result, if the incoming list has gaps, the outgoing list will also have gaps.
Whether or not to delete the original list entry when renaming. If set to Yes then renaming will create a new attribute with the desired name and the original entry will still remain. If set to No then the attribute will be renamed.
When promoting a specific element in a list, if Keep Original List is set to No, all list elements that do not match the specified element to promote will be removed.
This table will be populated appropriately when the user selects a List to Process and List Action. For each component, the ‘New Name’ column specifies the desired name for the component.
To rename a component, type the desired component name in the ‘New Name’ column for that component. Then at runtime, the transformer will rename the components to the desired component names.
Examples
Example 1
If the List to Process is somelist{} and the incoming feature contains:
somelist{0}.length = 7.3
somelist{2}.length = 5
somelist{3}.height = 6
If somelist{} is renamed to anotherName{}, the result will be:
anotherName{0}.length = 7.3
anotherName{2}.length = 5
anotherName{3}.height = 6
Example 2
If the List to Process is somelist{}.listTwo{}, the List Action is Promote – listTwo{1}, and the incoming feature contains:
somelist{0}.listTwo{0} = 0
somelist{0}.listTwo{1} = 1
somelist{0}.listTwo{3} = 2
Then the result will be:
somelist{0}.listTwo = 1
Example 3
If the List to Process is somelist{}.listTwo{}, the List Action is Promote – listTwo{1} and the incoming feature contains:
somelist{0}.listTwo{0}.length = 0
somelist{0}.listTwo{1}.length = 1
somelist{0}.listTwo{1}.height{0} = 3
somelist{0}.listTwo{3}.length = 2
Then the result will be:
somelist{0}.length = 1
somelist{0}.height{0} = 3
Example 4
If the List to Process is somelist{}, the List Action is Promote All Subcomponents and incoming feature contains the following:
somelist{0}.length = 7.3
somelist{2}.length = 5
somelist{3}.height = 6
The result will be:
length{0} = 7.3
length{2} = 5
height{3} = 6
Additional Resources
Editing Transformer Parameters
Using a set of menu options, transformer parameters can be assigned by referencing other elements in the workspace. More advanced functions, such as an advanced editor and an arithmetic editor, are also available in some transformers. To access a menu of these options, click beside the applicable parameter. For more information, see Transformer Parameter Menu Options.
Defining Values
There are several ways to define a value for use in a Transformer. The simplest is to simply type in a value or string, which can include functions of various types such as attribute references, math and string functions, and workspace parameters. There are a number of tools and shortcuts that can assist in constructing values, generally available from the drop-down context menu adjacent to the value field.
Using the Text Editor
The Text Editor provides a convenient way to construct text strings (including regular expressions) from various data sources, such as attributes, parameters, and constants, where the result is used directly inside a parameter.
Using the Arithmetic Editor
The Arithmetic Editor provides a convenient way to construct math expressions from various data sources, such as attributes, parameters, and feature functions, where the result is used directly inside a parameter.
Conditional Values
Set values depending on one or more test conditions that either pass or fail.
Parameter Condition Definition Dialog
Content
Expressions and strings can include a number of functions, characters, parameters, and more.
When setting values - whether entered directly in a parameter or constructed using one of the editors - strings and expressions containing String, Math, Date/Time or FME Feature Functions will have those functions evaluated. Therefore, the names of these functions (in the form @<function_name>) should not be used as literal string values.
These functions manipulate and format strings. | |
Special Characters |
A set of control characters is available in the Text Editor. |
Math functions are available in both editors. | |
Date/Time Functions | Date and time functions are available in the Text Editor. |
These operators are available in the Arithmetic Editor. | |
These return primarily feature-specific values. | |
FME and workspace-specific parameters may be used. | |
Creating and Modifying User Parameters | Create your own editable parameters. |
Dialog Options - Tables
Transformers with table-style parameters have additional tools for populating and manipulating values.
Row Reordering
|
Enabled once you have clicked on a row item. Choices include:
|
Cut, Copy, and Paste
|
Enabled once you have clicked on a row item. Choices include:
Cut, copy, and paste may be used within a transformer, or between transformers. |
Filter
|
Start typing a string, and the matrix will only display rows matching those characters. Searches all columns. This only affects the display of attributes within the transformer - it does not alter which attributes are output. |
Import
|
Import populates the table with a set of new attributes read from a dataset. Specific application varies between transformers. |
Reset/Refresh
|
Generally resets the table to its initial state, and may provide additional options to remove invalid entries. Behavior varies between transformers. |
Note: Not all tools are available in all transformers.
FME Community
The FME Community is the place for demos, how-tos, articles, FAQs, and more. Get answers to your questions, learn from other users, and suggest, vote, and comment on new features.
Search for samples and information about this transformer on the FME Community.