Solved

Transpose a Table

  • 15 January 2023
  • 3 replies
  • 79 views

Badge

Hello!

I know there are quite a few posts on the subject, but despite everything, I could not apply the solutions to my information.

I have a worksheet that produces an ffs file for me, attached, (I changed the names in Hebrew to letters and numbers..)

The file represents a neighborhood by type of consumption and amount of water consumed in it.

my output is this:

image 

How can I Transpose it into this:

image2(The number 1288.64 as a generic representative of consumption..)

I would really appreciate your help!

The excel file here represents an idea, at the end I write the FFS file for other formats..

icon

Best answer by ebygomm 16 January 2023, 14:25

View original

3 replies

Badge +10

It should be as simple as using the value of the column consumption type to set the attribute name, using last read as the value. Exposing the created attributes (A,B,C etc.), then merging with an aggregator grouping on neighbourhood and choosing merge incoming attributes. Lastly remove the original attributes

image

Badge

Thanks!

It works!

It should be as simple as using the value of the column consumption type to set the attribute name, using last read as the value. Exposing the created attributes (A,B,C etc.), then merging with an aggregator grouping on neighbourhood and choosing merge incoming attributes. Lastly remove the original attributes

image

This approach works best for me - I've used the AttributeTransposer custom transformer with some success (make sure you expose those new attributes!) but the "All original attributes will still be exposed on the output feature, but will not have a value" has been a challenge (I was trying to keep fme_feature_type). This Safe article about "Using the Aggregator Transformer" is along the lines of this solution but overly complicated for what I was trying to achieve. Perhaps they should update the article to include this solution. Either way, thank you @ebygomm​ for the elegant solution!

Reply