Suppose I have one feature per attribute country
that is linked to a complex list attribute called stations
with the sub-attributes name
and platforms
that looks like this:
station{0}.name Gare du Nord
station{0}.platforms 32
station{0}.name Hamburg Hbf
station{0}.platforms 12
station{1}.name Munich Hbf
station{1}.platforms 32
station{2}.name Frankfurt(Main) Hbf
station{2}.platforms 29
station{0}.name Utrecht Centraal
station{0}.platforms 16
station{1}.name Amsterdam Centraal
station{1}.platforms 11
The ListExploder
would give me this (table 1):
country | element_index | name | platforms |
---|---|---|---|
France | 0 | Gare du Nord | 32 |
Germany | 0 | Hamburg Hbf | 12 |
Germany | 1 | Munich Hbf | 32 |
Germany | 2 | Frankfurt(Main) Hbf | 29 |
The Netherlands | 0 | Utrecht Centraal | 16 |
The Netherlands | 1 | Amsterdam Centraal | 11 |
However, I need a transposed version of the table, where a new attribute is created for each combination of index and sub-attribute in the list attribute (table 2):
country | station{0}.name | station{0}.platforms | station{1}.name | station{1}.platforms | station{2}.name | station{2}.platforms |
---|---|---|---|---|---|---|
France | Gare du Nord | 32 | ||||
Germany | Hamburg Hbf | 12 | Munich Hbf | 32 | Frankfurt(Main) Hbf | 29 |
The Netherlands | Utrecht Centraal | 16 | Amsterdam Centraal | 11 |
As you can see, the number of indices (stations
) in the list attribute differs per feature (country
), resulting in a dynamic allocation of attributes.
How can I transpose the contents of a list to get a table structure like in table 2 with FME?
I'm using FME Workbench 2021.2