Coalesce by removing the two leading characters without removing the characters from target table

heathers_
Kilo Sage

Hi all. We have a requirement to coalesce on a string field. The target table/field has an additional two leading characters that do not exist on the source file. Without removing the characters from the target field, how do we best approach the transform script?

EX:

Source Field: "0234"

Target Field: "000234"

 

Need to strip the two leading characters from target field to map on source field, while not truly removing the characters from the target field.

 

 

1 ACCEPTED SOLUTION
3 REPLIES 3

Kieran Anson
Kilo Patron

Conditional Coalesce is what you're after. 

 

Updating records using coalesce 

Thank you. The conditional script is where I'm stuck.

1. Remove the first two characters from target.name

2. Coalesce on target.name using source.u_site_code

 

    var str = target.name.toString();
    var newStr = str.substring(2);
	
    newStr = source.u_site_code;