Transform Map: Insert multiple records from single source record

Lohith
Giga Expert

I have an CSV file which has a field that contains a comma separated list of items. I need to create a record in the target table for each item listed in the comma separated list.

For example, a source record may look like this:
Field1: Hyundai
Field2: Verna, I20, Creta

The result in the target table should have a record for each of Field2:
Record1: Field1=Hyundai Field2=Verna
Record2: Field1=Hyundai Field2=I20
Record3: Field1=Hyundai Field2=Creta

Any inputs will be much appreciated.

Thanks

5 REPLIES 5

RAHUL Khanna1
Mega Guru

you can write on before script and do some string manipulation ...and can insert the record ........

 

on Before Script; 

var f1 = source.field1; 

var f2 = [] ;

 f2 = soource.field2.split(',')

 

for(var i = 0; i < f2.length ; f2++)

{

var gr target = new GlideRecord('target Table Name');

gr.initialize()

gr.field1 = f1; 

gr.field2 = f2[i];

gr.insert(); 

}