How do I append to the description field in the transform map?

phantom7
Giga Expert

Hi,

I am stuck on this transform script. I am tasked with appending to the description field in the target table if the source field's value is different. So first I need to check if the description field contains the source field, if not then append. for example:

Source record:

Name     LastName       Address      ID        description

John       Smith             1 home        123       JSmith.domain.com

Target Table

Name     LastName       Address      ID         description

John       Smith             1 home        123      George.domain.com

in the above example, instead of updating the record and overriding "George.domain.com", I would like to append a comma and then "JSmith.domain.com" to description. So the result would be this:

Name     LastName       Address      ID         description

John       Smith             1 home        123      George.domain.com, JSmith.domain.com

 

 

Can anyone help me with this? Thank you 🙂

1 ACCEPTED SOLUTION

Mike Allen
Mega Sage

Something like this:

 

if(target.description == source.description)

    ignore = true;

else

    target.description += ", " + source.description;

 

though I remember maybe having to query the target record before to get the current description, so you can try that in place of the target.description.

View solution in original post

3 REPLIES 3

Mike Allen
Mega Sage

Something like this:

 

if(target.description == source.description)

    ignore = true;

else

    target.description += ", " + source.description;

 

though I remember maybe having to query the target record before to get the current description, so you can try that in place of the target.description.

do I run this in the onbefore script?

I think I have run mine onBefore, historically.