Skip to main content
Solved

Transposing values for every row in table using field names

  • November 11, 2020
  • 6 replies
  • 39 views

gerard
Participant
Forum|alt.badge.img

Hi,

Please, any transformer suggestion about how transpose the Table1 into Table2 ?

 

Table1

ID Field2005 Field2006 Field2009 Field2018

1 10.0    28.0  23.8    -3.8

2 80.0    34.0    -3.8    40.0

 

Table2

ID YEAR VALUE

1 2005 10.0

1 2006 28.0

1 2009 23.8

1 2018 -3.8

2 2005 80.0

2 2006 34.0

2 2009 -3.8

2 2018 40.0

 

Neither of List transformers nor AttributeExploder + Aggregator transformers work in this case. I have been working with these examples [1] but I don't get exactly what I need. 

 

Before using PythonCaller I would like to inspect other transformer possiblities. So, any FME workpace example or transformer suggestion is apreciated.

 

Thank you

 

[1] https://community.safe.com/s/article/transpose-a-table-using-fme

Best answer by ebygomm

AttributeExploder and then a bit of tidying up should work

Capture 

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

6 replies

ebygomm
Influencer
Forum|alt.badge.img+44
  • Influencer
  • 3427 replies
  • Best Answer
  • November 11, 2020

AttributeExploder and then a bit of tidying up should work

Capture 


gerard
Participant
Forum|alt.badge.img
  • Author
  • Participant
  • 15 replies
  • November 12, 2020

AttributeExploder and then a bit of tidying up should work

Capture 

Thank you very much for your quick answer !!!

I'm sorry, I see that my sample data is confusing: the field ID is not an autonumeric, it is a char code that must be included in each outout record.

For this reason I was trying to use Aggregator Transfomer.

 

To be more expecific, if I have this input.xls file:

fmeinputI would like to have this output.xls file,

fmeoutput 

Up to now, I have this result, so I'm working in some king or aggregation by CODE field.

fmeresultThanks for your help @ebygomm​ 


ebygomm
Influencer
Forum|alt.badge.img+44
  • Influencer
  • 3427 replies
  • November 12, 2020

Thank you very much for your quick answer !!!

I'm sorry, I see that my sample data is confusing: the field ID is not an autonumeric, it is a char code that must be included in each outout record.

For this reason I was trying to use Aggregator Transfomer.

 

To be more expecific, if I have this input.xls file:

fmeinputI would like to have this output.xls file,

fmeoutput 

Up to now, I have this result, so I'm working in some king or aggregation by CODE field.

fmeresultThanks for your help @ebygomm​ 

Should there be a file attached here?

 

"the field ID is not an autonumeric, it is a char code that must be included in each output record."

 

In the above example the ID will be included in every record, it doesn't matter what the value of it is. It exists due to the setting on the AttributeExploder being set as Keep Attributes to Yes


gerard
Participant
Forum|alt.badge.img
  • Author
  • Participant
  • 15 replies
  • November 12, 2020

Thank you very much for your quick answer !!!

I'm sorry, I see that my sample data is confusing: the field ID is not an autonumeric, it is a char code that must be included in each outout record.

For this reason I was trying to use Aggregator Transfomer.

 

To be more expecific, if I have this input.xls file:

fmeinputI would like to have this output.xls file,

fmeoutput 

Up to now, I have this result, so I'm working in some king or aggregation by CODE field.

fmeresultThanks for your help @ebygomm​ 

Yes, the images were not attached in the first reply.

Now you can see sample files.

Thanks @ebygomm​  for your time !


ebygomm
Influencer
Forum|alt.badge.img+44
  • Influencer
  • 3427 replies
  • November 12, 2020

It's exactly the same principle, just some slightly different handling due to the field names, but still AttributeExploder>Tester>AttributeCreator>AttributeKeeper

Capture 


gerard
Participant
Forum|alt.badge.img
  • Author
  • Participant
  • 15 replies
  • November 12, 2020

Thank you very much for your quick answer !!!

I'm sorry, I see that my sample data is confusing: the field ID is not an autonumeric, it is a char code that must be included in each outout record.

For this reason I was trying to use Aggregator Transfomer.

 

To be more expecific, if I have this input.xls file:

fmeinputI would like to have this output.xls file,

fmeoutput 

Up to now, I have this result, so I'm working in some king or aggregation by CODE field.

fmeresultThanks for your help @ebygomm​ 

Yes, you are right, in AttributeExploder transformer Keep Attributes must be Yes.

Thanks a lot, the problem is solved !!!