Skip to main content

So, what would be the easiest way to do this. Lets say we have generated 2 separate, but parallel Lists like this (say from ListExpressionPopulator):

  • Colours{}
  • Precincts{}

And it is desired to combine these into a single list with the original list names as instead the component names like this:

  • Report{}Colours
  • Report{}Precincts

As far as I can tell, this can't be done with either ListRenamer or AttributeRenamer, and the closest got to is using BulkAttributeRenamer.

Hi @bwn, as far as I know, except scripting (Python, Tcl, XQuery etc.), the only way is to use the BulkAttributeRenamer with Regular Expression Replace mode, as in:

Attributes to Rename:
    Rename: All Attributes
Parameters:
    Action: Regular Expression Replace
    Mode: Rename
    Text To Find: (Colours|Precincts){(\d+)}
    String: Report{\2}.\1

However, the BulkAttributeRenamer won't expose the new list names and also won't hide the old list names. You will have to expose the new names and hide the old names in the subsequent process if necessary.


Hi @bwn, as far as I know, except scripting (Python, Tcl, XQuery etc.), the only way is to use the BulkAttributeRenamer with Regular Expression Replace mode, as in:

Attributes to Rename:
    Rename: All Attributes
Parameters:
    Action: Regular Expression Replace
    Mode: Rename
    Text To Find: (Colours|Precincts){(\d+)}
    String: Report{\2}.\1

However, the BulkAttributeRenamer won't expose the new list names and also won't hide the old list names. You will have to expose the new names and hide the old names in the subsequent process if necessary.

Alternatively, the ListZipper transformer from FME Hub might help you.


Alternatively, the ListZipper transformer from FME Hub might help you.

Thanks @takashi, that's almost identical to the solution using as well. I was just wondering if I had missed any simpler solutions as it gets a little inelegant having to brute force exposing the renamed List Attributes with AttributeExposer.

Almost all the List Creation or Alteration Transformers don't seem to be able to output Lists with Component Labels from experimenting with most of them?


Alternatively, the ListZipper transformer from FME Hub might help you.

...Oh and I like the functionality of ListZipper too @takashi. Another nice contribution from yourself to the Custom Transfomer Hub!


Hi @bwn, as far as I know, except scripting (Python, Tcl, XQuery etc.), the only way is to use the BulkAttributeRenamer with Regular Expression Replace mode, as in:

Attributes to Rename:
    Rename: All Attributes
Parameters:
    Action: Regular Expression Replace
    Mode: Rename
    Text To Find: (Colours|Precincts){(\d+)}
    String: Report{\2}.\1

However, the BulkAttributeRenamer won't expose the new list names and also won't hide the old list names. You will have to expose the new names and hide the old names in the subsequent process if necessary.

@bwn, please add a comment to and vote up these ideas ;-)

https://knowledge.safe.com/content/idea/19590/easy-way-to-create-structured-list-from-multiple-c.html 

https://knowledge.safe.com/content/idea/59213/listrenamer-allow-demotions.html


Upvoted! Yes similarly how trouble trying to deal with the output of AttributeSplitter used on multiple Attributes to generate parallel lists. ListRenamer etc. was among the first Transformers that I investigated to see if they could turn simple lists into Structured lists with components and your previous posting a couple of years ago using BulkAttributeRenamer as a workaround the best could find.


Hi @bwn, as far as I know, except scripting (Python, Tcl, XQuery etc.), the only way is to use the BulkAttributeRenamer with Regular Expression Replace mode, as in:

Attributes to Rename:
    Rename: All Attributes
Parameters:
    Action: Regular Expression Replace
    Mode: Rename
    Text To Find: (Colours|Precincts){(\d+)}
    String: Report{\2}.\1

However, the BulkAttributeRenamer won't expose the new list names and also won't hide the old list names. You will have to expose the new names and hide the old names in the subsequent process if necessary.

Here is another solution: MultiAttributeSplitter

https://hub.safe.com/publishers/pacific-spatial-solutions/transformers/multiattributesplitter 


Reply