# Reference Table to Map?

**URL:** <https://forum.cloverdx.com/t/reference-table-to-map/1799>\
**Category:** CloverDX Platform\
**Created:** [October 7, 2016, 12:00am UTC](https://forum.cloverdx.com/t/reference-table-to-map/1799 "2016-10-07T00:00:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jardineworks](https://yyz1.discourse-cdn.com/flex007/user_avatar/forum.cloverdx.com/jardineworks/32/72_2.png) [@jardineworks](https://forum.cloverdx.com/u/jardineworks)\
**Post date:** [October 7, 2016, 12:00am UTC](https://forum.cloverdx.com/t/reference-table-to-map/1799/1 "2016-10-07T00:00:00Z")

</div>

Honestly, I’m not even sure what to use for a title. I am working on a data migration and have a problem I am not sure how to solve. A few things right out the gate –

1. I am by no means a data wizard and my knowledge of clover is pretty basic.  
2. The version I am using the 4.3 Community

… I have a table with User records, or at least PART of a user record. In this table I have an ID column. In a separate table I have a set of records related to a user via the ID. So in the UsersMetadata table I have something like…

user\_id meta\_key meta\_value  
1 first\_name andrew  
1 last\_name jardine  
1 nickname aj  
…  
2 first\_name chris  
2 last\_name chan  
2 nickname jackie chan

etc.

I am trying to flatten my user records to be exported to a CSV so that I have

userId firstName lastName nickname  
1 andrew jardine aj  
2 chris chan jackie chan  
etc.

There are literally about 50+ “meta fields” – some of them I no longer need. Right now the only solution I have come up with , which SUCKS … is to have a component that reads a meta key (eg. firstName) and then UPDATES a record in a mast table, then it reads the lastName, updates the table… but this is a pretty brutal way to do it and I am sure that there is something more clever and quick.

Can someone help me out?

---

<div class="post-metadata">

**Author:** ![PedroVazquezRosario](https://avatars.discourse-cdn.com/v4/letter/p/ed8c4c/32.png) [@PedroVazquezRosario](https://forum.cloverdx.com/u/PedroVazquezRosario)\
**Post date:** [October 11, 2016, 3:56pm UTC](https://forum.cloverdx.com/t/reference-table-to-map/1799/2 "2016-10-11T15:56:56Z")

</div>

Hi jardineworks,

From the way your data is set up, I would recommend that you use the Pivot component which you can read more about in our documentation [here](http://doc.cloveretl.com/documentation/UserGuide/index.jsp?topic=/com.cloveretl.gui.docs/docs/pivot.html). You will want to output your data exactly as in your example using the DBInputTable component then use the Pivot (make sure that the output metadata is the same name as the meta\_key field).

I have taken the liberty of attaching a sample graph with your use case.

- [pivotexample.grf](https://cdn.cloverdx.com/forum/18200%5F143c54ed6b3c6e260957533fcd5b59d3/pivotexample.grf)

---

<div class="post-metadata">

**Author:** ![PedroVazquezRosario](https://avatars.discourse-cdn.com/v4/letter/p/ed8c4c/32.png) [@PedroVazquezRosario](https://forum.cloverdx.com/u/PedroVazquezRosario)\
**Post date:** [October 12, 2016, 11:54am UTC](https://forum.cloverdx.com/t/reference-table-to-map/1799/3 "2016-10-12T11:54:47Z")

</div>

Hi,

I forgot to mentioned that you can join your data based on the ID using our joiner components, such as [ExtHashJoin](http://doc.cloveretl.com/documentation/UserGuide/index.jsp?topic=/com.cloveretl.gui.docs/docs/exthashjoin.html).
