Skip to main content

REPLACE

The REPLACE function in Data Synchronization Studio is used to replace all occurrences of a specified string value with another string value.

It takes three inputs: value, oldValue, and newValue. The value input is the original string that you want to search in, the oldValue input is the string that you want to replace, and the newValue input is the new string that you want to put in place of the oldValue.

Syntax

string REPLACE(string value, string oldValue, string newValue)

Inputs

ObjectData TypeDescription
valueStringThe original string to look in.
oldValueStringThe old string to replace.
newValueStringThe new string to put in place.

Example

REPLACE("Product", "Product", "Software")

Will replace all "Product" instances with "Software".


Another example of using the REPLACE function is to replace invalid characters in a file name with a valid character. For instance, in SharePoint, certain characters are not valid for file names such as ~ " # % & * : < > ? / \ { | }.

If you have a file name with any of these characters, you can use the REPLACE function to replace them with a valid character like an underscore.

For example, the following expression can be used to replace a specific character in a file name with an underscore:

REPLACE(FileName, "[CHARACTER]", "_") 

This would replace the specified character in the file name with an underscore.