Join multiple rows in one record

User659586
Mega Guru

Hello!

Can you please tell me how can I merge 3 rows into one using a transform map?

For example, imported data:

Field1 Field2
123 Ba
123 Bo
123 Bu

Expected output (created record):

Field1 Field2
123 Ba,Bo,Bu

How can I accomplish this using a Transform Map?

4 REPLIES 4

Prasad Pagar
Mega Sage

Hi,

Did you tried using Transform Scripts? You can play with Source data using Transform scripts

Thank you
Prasad

Should the Transform Script be onBefore, onAfter, onComplete?

Mahak2
Kilo Guru

Hello,

Please use this script and test it,its untested.

var concatString ='' ;

// Initialise GlideRecord and get the results
var gr = new GlideRecord('sourcetable');
gr.query();

while(gr.next()) {

    
    concatString+=','+gr.field2;
}

concatString = gr.field1 + concatString;

Please mark my response as Helpful/Correct if applicable.

Thanks

The field1 should be like an ID, for example there's 2 rows that are the same record but contains different field2 information. How can I join multiple rows related to the same record but combining the field2 information?