Skip to main content
Solved

Merge records into single row per key


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.

View original
Did this help you find an answer to your question?

5 replies

ebygomm
Influencer
Forum|alt.badge.img+32
  • Influencer
  • 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
Contributor
Forum|alt.badge.img+17
  • Contributor
  • July 24, 2018
ebygomm wrote:

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
  • July 25, 2018
ebygomm wrote:

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
  • 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
Supporter
  • July 25, 2018
ebygomm wrote:

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.

 

 


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