Solved

Transpose Colums/Rows

  • 17 April 2024
  • 7 replies
  • 136 views

Badge +4

Searched for possible solutions here, but nothing yet.

 

Have :
 

col0 col1 col2 col3 col4
Region A BU02851 BU02852 BU02853 BU02854
Region Value A 50 55 40 10
Region Value B 7 11 4 15
Region Value C 60 70 10 25

 

Need :

 

Region A Region Value C      
BU02851 60      
BU02852 70      
BU02853 10      
BU02854 25      

 

What steps do I need to take to get this done?

 

Thanks in Advance !

 

icon

Best answer by joepk 18 April 2024, 10:25

View original

7 replies

Userlevel 4
Badge +17

I always avoid transposing in FME because it gives me such a headache. I wanted to challenge myself and do it this time. See attached workspace (FME 2021). I don't like how it turned out and I hardly understand what I am doing myself.

The hardcoded AttributeCreators are bothering me the most. It feels like this must be doable dynamically with some proper Aggregator/AttributeExploder list-based-merge-wizardry. Welp, maybe next time.

 

Userlevel 4
Badge +13

Perhaps a similar solution to this thread:

The solution I proposed in that thread is similar to what @joepk has already suggested. And I will agree with @joepk, transposing in either direction is certainly headache inducing.

Userlevel 4
Badge +13

I proposed a similar solution to what @joepk has suggested in another thread, but using the AttributeExploder set to list, followed up with a ListExploder. I will link it here once the post is approved.

Userlevel 4
Badge +17

Thanks for the push @liamfez, it is done 😎

What a relief, hehe.
Hope this helps!

Badge +4

Thanks for the push @liamfez, it is done 😎

What a relief, hehe.
Hope this helps!

Thank you very much for your efforts.
It's more complicated than I thought. But luckily I can move on :)
Hopefully you don't have a headache anymore.

Userlevel 5
Badge +36

Very nice!

Just a small note: you can skip Tester_3 (Filter out Features where attr_name Begins With "fme_”) when you tell the AttributeExploder to ignore attributes starting with "fme_” using the ‘Ignore Attributes Containing’ option (see below).

The field contains a regular expression, so enter ^fme_ (which means attributes that start with “fme_”).

 

Userlevel 4
Badge +13

Very nice!

Just a small note: you can skip Tester_3 (Filter out Features where attr_name Begins With "fme_”) when you tell the AttributeExploder to ignore attributes starting with "fme_” using the ‘Ignore Attributes Containing’ option (see below).

The field contains a regular expression, so enter ^fme_ (which means attributes that start with “fme_”).

 

One more reason I hope I get to update to Form soon, still using 2021 for the time being and that does not appear to be an option. That is a small but very handy update to that transformer.

Reply