Solved

Merge records into single row per key

  • 24 July 2018
  • 5 replies
  • 37 views

Badge

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

icon

Best answer by ebygomm 24 July 2018, 16:50

View original

5 replies

Userlevel 1
Badge +21

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.

Userlevel 4
Badge +13

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.

 

 

Badge

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!

 

 

Badge

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

Userlevel 2
Badge +17

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.

 

 

Reply