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,inlist{}.blat{}.foo,there are 3 components.Two components are lists:list{}andblat{}.One component is not a list:foo.
- Subcomponent – This is a component of a list.Thus,inlist{}.blat{}.foo,blat{}is a subcomponent oflist{}.Similarly,foois a subcomponent ofblat{}.
- Structured List – a list for which a subcomponent contains more than one piece of data.The elements of the structure are represented asfoo{}.aorfoo{}.b.
Parameters
![Closed](http://www.baooytra.com/docs/fme/2017.0/html/FME_Desktop_Documentation/FME_Transformers/Skins/Default/Stylesheets/Images/transparent.gif)
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 theList to Processwill cause theList Actionto switch toRename.
![Closed](http://www.baooytra.com/docs/fme/2017.0/html/FME_Desktop_Documentation/FME_Transformers/Skins/Default/Stylesheets/Images/transparent.gif)
The action to perform on the list.
- Renamemeans 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 theList Components To Renametable.The ‘New Name' will default to the old one.
-
Promotemeans the last component of theList to Processwill 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 theList To Processis 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,theList Components to Renamewill be populated with the components of theList to Processup until the last component.
-
Promote All Subcomponentsmeans 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,theList Components to Renamewill give the list of the subcomponents of theList 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.
![Closed](http://www.baooytra.com/docs/fme/2017.0/html/FME_Desktop_Documentation/FME_Transformers/Skins/Default/Stylesheets/Images/transparent.gif)
Whether or not to delete the original list entry when renaming.If set toYesthen renaming will create a new attribute with the desired name and the original entry will still remain.If set toNothen the attribute will be renamed.
When promoting a specific element in a list,ifKeep Original Listis set toNo,all list elements that do not match the specified element to promote will be removed.
![Closed](http://www.baooytra.com/docs/fme/2017.0/html/FME_Desktop_Documentation/FME_Transformers/Skins/Default/Stylesheets/Images/transparent.gif)
This table will be populated appropriately when the user selects aList to ProcessandList 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 theList to Processissomelist{}and the incoming feature contains:
somelist{0}.length = 7.3
somelist{2}.length = 5
somelist{3}.height = 6
Ifsomelist{}is renamed toanotherName{},the result will be:
anotherName{0}.length = 7.3
anotherName{2}.length = 5
anotherName{3}.height = 6
Example 2
If theList to Processissomelist{}.listTwo{},theList ActionisPromote – 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 theList to Processissomelist{}.listTwo{},theList ActionisPromote – 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 theList to Processissomelist{},theList ActionisPromote All Subcomponentsand 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,clickbeside the applicable parameter.For more information,seeTransformer Parameter Menu Options.
Transformer Categories
Search FME Knowledge Center
Search for samples and information about this transformer on theFME Knowledge Center.