# Denormalize input file

**URL:** <https://forum.cloverdx.com/t/denormalize-input-file/309>\
**Category:** CloverDX Platform\
**Created:** [May 1, 2008, 12:00am UTC](https://forum.cloverdx.com/t/denormalize-input-file/309 "2008-05-01T00:00:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![stringer](https://avatars.discourse-cdn.com/v4/letter/s/eb8c5e/32.png) [@stringer](https://forum.cloverdx.com/u/stringer)\
**Post date:** [May 1, 2008, 12:00am UTC](https://forum.cloverdx.com/t/denormalize-input-file/309/1 "2008-05-01T00:00:00Z")

</div>

I’ve read this forum topic:[merging lines in input file](http://forum.cloveretl.org/viewtopic.php?t=374) and looked at the two examples:  
[http://wiki.clovergui.net/examples/graphDenormalizeInline.grf](http://wiki.clovergui.net/examples/graphDenormalizeInline.grf)  
[http://wiki.clovergui.net/examples/graphDenormalizeTL.grf](http://wiki.clovergui.net/examples/graphDenormalizeTL.grf)  
but I can’t figure out how to make it work. The examples seem to only dedupe the data.

As per the post I mentioned above, I want to take:  
group1,record1  
group1,record2  
group2,record1  
group2,record2  
group2,record3

and transform to:  
group1,record1,record2  
group2,record1,record2,record3

Can anyone help me out here?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![avackova](https://avatars.discourse-cdn.com/v4/letter/a/65b543/32.png) [@avackova](https://forum.cloverdx.com/u/avackova)\
**Post date:** [May 5, 2008, 8:35am UTC](https://forum.cloverdx.com/t/denormalize-input-file/309/2 "2008-05-05T08:35:50Z")

</div>

```auto
<?xml version="1.0" encoding="UTF-8"?>
<Graph author="avackova" created="Mon May 05 08:57:00 CEST 2008" guiVersion="1.9" id="1209974901675" licenseType="Evaluation license." modified="Mon May 05 10:26:02 CEST 2008" modifiedBy="avackova" name="Denormalize" revision="1.18">
<Global>
<Metadata id="Metadata0">
<Record fieldDelimiter="|" name="data" recordDelimiter="\n" type="delimited">
<Field name="group" type="string"/>
<Field name="value" type="string"/>
</Record>
</Metadata>
</Global>
<Phase number="0">
<Node id="DATA_GENERATOR0" pattern="group1
" randomFields="value=random(&quot;2&quot;,&quot;5&quot;)" recordsNumber="10" type="DATA_GENERATOR"/>
<Node id="DENORMALIZER0" key="group" type="DENORMALIZER">
<attr name="denormalize"><![CDATA[//#TL
              string members="";
  
              function addInputRecord() {
                members = concat(members,$value,";");
              }
 
              function getOutputRecord() {
				string value = members;
				members = "";
                $group := $group;
                $value := value;
              }]]></attr>
</Node>
<Node id="EXT_SORT0" sortKey="group(a)" type="EXT_SORT"/>
<Node debugPrint="true" id="TRASH0" type="TRASH"/>
<Edge fromNode="DATA_GENERATOR0:0" id="Edge0" inPort="Port 0 (in)" metadata="Metadata0" outPort="Port 0 (out)" toNode="EXT_SORT0:0"/>
<Edge fromNode="DENORMALIZER0:0" id="Edge1" inPort="Port 0 (in)" metadata="Metadata0" outPort="Port 0 (out)" toNode="TRASH0:0"/>
<Edge fromNode="EXT_SORT0:0" id="Edge2" inPort="Port 0 (in)" metadata="Metadata0" outPort="Port 0 (out)" toNode="DENORMALIZER0:0"/>
</Phase>
</Graph>

```

Node Denormalizer for each group with the same key (the same value of _group_ data field) creates string containing all passed values; when whole group is read, it creates one output record putting on _group_ data field value from _group_ data field (the same for whole group) and on the _value_ data field created string. For proper working Denormalizer needs **sorted** input.
