Skip to main content
Solved

Merge records into single row per key

  • July 24, 2018
  • 5 replies
  • 277 views

Forum|alt.badge.img

Hi,

I have this data below which I would like to transform into a single record per row.key. How do I do it?

Ideal output would be 2 records with field.name converted to columns.

Cheers

Best answer by ebygomm

I would typically create a new attribute using the field.name value and set it to the value of field for each record. Then expose these attributes and then aggregate based on row.key. This assumes you know all possible field.names to expose

e.g.

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.

5 replies

ebygomm
Influencer
Forum|alt.badge.img+44
  • Influencer
  • 3430 replies
  • Best Answer
  • July 24, 2018

I would typically create a new attribute using the field.name value and set it to the value of field for each record. Then expose these attributes and then aggregate based on row.key. This assumes you know all possible field.names to expose

e.g.


fmelizard
Safer
Forum|alt.badge.img+20
  • Safer
  • 3719 replies
  • July 24, 2018

I would typically create a new attribute using the field.name value and set it to the value of field for each record. Then expose these attributes and then aggregate based on row.key. This assumes you know all possible field.names to expose

e.g.

Yep, that is the best way I'm aware of. I'd make the minor additional suggestion to tell the Aggregator NOT to assemble any geometry (the Mode -- set it to Attributes Only) -- that will save it some work.

 

 


Forum|alt.badge.img
  • Author
  • 8 replies
  • July 25, 2018

I would typically create a new attribute using the field.name value and set it to the value of field for each record. Then expose these attributes and then aggregate based on row.key. This assumes you know all possible field.names to expose

e.g.

awesome stuff! thanks!

 

 


Forum|alt.badge.img
  • Author
  • 8 replies
  • July 25, 2018

In relation to this one, Given the xml below

emp-record-sample.xml

I get this after XML Fragmenter

 

Is there a way that after it goes through the aggregator it concatenates the field.name "GIVEN_NAMES" into a single column? Or is it better to edit the XML and change one of the "GIVEN_NAMES" into say "FIRST_NAME" so I could exppose them separately?

Right now, I am getting this one below after AttributeExposer and just ignores the 2nd Given Name after going through Aggregator.

TIA


takashi
Celebrity
  • 7843 replies
  • July 25, 2018

I would typically create a new attribute using the field.name value and set it to the value of field for each record. Then expose these attributes and then aggregate based on row.key. This assumes you know all possible field.names to expose

e.g.

I often use the BulkAttributeRenamer, rather than the AttributeCreator. FYI.