Skip to main content
Question

Column to ROW as attribute name for other columns


Forum|alt.badge.img

Good day!

I'd like to change data structure from as shown on 1st

picture to structure as shown on 2nd picture.

Simply stated i want values replace from first column (Attributes) to attribute name values and second column should be values for these attributes. I think Attributes field on 1st picture will not be stable. Elements will change from time to time.

This is a subtotal result from big WB processing result...

I tried to use AttributeCreator, but result is not good(.

How can i do this?

Thanks)

7 replies

bruceharold
Contributor
Forum|alt.badge.img+17
  • Contributor
  • May 26, 2016

Use AttributeCreator with AttributeName set to @Value(Attribute) and Value set to Value


Forum|alt.badge.img
  • Author
  • May 26, 2016
bruceharold wrote:

Use AttributeCreator with AttributeName set to @Value(Attribute) and Value set to Value

It does not work...I tried to do how you said, but nothing changes.

Also, I saved the result as xls file and tried to do this again...nothing.


takashi
Contributor
Forum|alt.badge.img+21
  • Contributor
  • May 27, 2016
sega wrote:

It does not work...I tried to do how you said, but nothing changes.

Also, I saved the result as xls file and tried to do this again...nothing.

Hi @sega, I think the AttributeCreator should work, but the new attribute names will not be exposed automatically on the Workbench interface. Check the result with the Logger or the Feature Information pane of FME Data Inspector. You can expose the attribute names manually with the AttributeExposer optionally.


Forum|alt.badge.img
  • Author
  • May 27, 2016
takashi wrote:

Hi @sega, I think the AttributeCreator should work, but the new attribute names will not be exposed automatically on the Workbench interface. Check the result with the Logger or the Feature Information pane of FME Data Inspector. You can expose the attribute names manually with the AttributeExposer optionally.

Hello @takashi, yes, I did like you say. It works)

But what if attributes are not stable? It means...names and counts of attributes are changing. Today I have all attributes shown on this example and tomorrow i will get these attributes and one( two, three...) more (f.e. Vessel Type). If I will use AttributeCreator ---> AttributeExposer with predefined list of exposed attr, I will lose "Vessel Type"...

How to solve this situation "dynamically"?

Thanks!)


takashi
Contributor
Forum|alt.badge.img+21
  • Contributor
  • May 27, 2016
sega wrote:

Hello @takashi, yes, I did like you say. It works)

But what if attributes are not stable? It means...names and counts of attributes are changing. Today I have all attributes shown on this example and tomorrow i will get these attributes and one( two, three...) more (f.e. Vessel Type). If I will use AttributeCreator ---> AttributeExposer with predefined list of exposed attr, I will lose "Vessel Type"...

How to solve this situation "dynamically"?

Thanks!)

If the schema (the number of attributes and their names etc.) may be vary, you will have to implement a work flow to create the schema based on the source data at run-time, and also apply the dynamic schema to the writer.

There are several ways and variations to do that, but It's hard to find an appropriate way based on the current limited information.

Firstly you need to learn about the Dynamic Workflow. I think this article would be a good starting point.

Tutorial: Dynamic Workflows


gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • May 28, 2016

check out suggestions under dynamic attribute creation.


Forum|alt.badge.img
  • Author
  • May 30, 2016

@takashi, @bruceharold thanks a lot for your suggestions


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings