- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2019 08:27 AM
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!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2019 08:57 AM
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(", ");
Vinod Kumar Kachineni
Community Rising Star 2022
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2019 08:44 AM
Hi,
You can write an onbefore transfrom map script with the following line in it.
target.field_name = source.u_field_a + ', '+ souce.u_field_b + ', ' +source.ufield_c;
Replace your field names appropriately
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2019 09:01 AM
Hi,
This worked, however, seeing an issue when not all 3 source fields have values, the empty field is copying with a target out put of 'This are my notes from a, and from b, ,'
Is there a way to skip over the empty fields from source, so it doesn't write with a ' ,' in the target field?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2019 09:06 AM
Try the script provided by vkachineni
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2019 08:57 AM
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(", ");
Vinod Kumar Kachineni
Community Rising Star 2022