Concat string fields in various rows to a single row

Hello,

I was expecting the aggregator step transform to be able to concat a string field and give back only one big string.

How could I achieve that?

Thanks

Hi Fabien,

There are more ways to achieve concatenation of all string fields in CloverDX. The most common way is to use the Denormalizer component which is designed to join data fields.
See our documentation about the Denormalizer here.

As an example, I created a simple table of data that looks like this:

In the Denormalizer, in Denormalize field you can use a CTL code that looks like this:

// This creates 3 lists of strings
string fields1;
string fields2;
string fields3;

function integer append() {

  //This snippet will fill the lists with data from all fields  

append(fields1, **$in.**0.field1);
append(fields2, **$in.**0.field2);
append(fields3, **$in.**0.field3);
//return length of the lists

return length(fields1);
}

function integer transform() {

//In the transform function itself we use the JOIN function to print
//those lists as one single field using different delimiters defined
**$out.**0.field1 = join(“”,fields1);
**$out.**0.field2 = join(" “,fields2);
**$out.**0.field3 = join(”;",fields2);

 **return** **OK**;  

}

See our documentation about string functions here.

The result then could look like this:

I hope this will help.

Best regards, Tom.