Transform Script combine multiple source fields into one target field

brown9394
Tera Expert

Hello Experts, 

I need to take 3 different Source fields and combine them into 1 target field. How can I do this with a transform script? 

For example:

Source fields -

field_a = 'These are my notes from a' 

field_b = 'and from b'

field_c = 'and from c'

And I want to combine it with a ', ' and space like this example output below in 1 Target table field -

field_a = 'These are my notes from a, and from b, and from c'

Thanks in advance! 

1 ACCEPTED SOLUTION

vkachineni
Kilo Sage
Kilo Sage

var combined = [];

if(source.u_field_a != '')
{
combined.push(source.u_field_a);
}
if(source.u_field_b != '')
{
combined.push(source.u_field_b);
}
if(source.u_field_c != '')
{
combined.push(source.u_field_c);
}

target.field_name = combined.join(", ");

Please mark Correct and click the Thumb up if my answer helps you resolve your issue. Thanks!
Vinod Kumar Kachineni
Community Rising Star 2022

View solution in original post

5 REPLIES 5

Thank you, that did the trick!