Unify and manage your data

String Cleanser

Learn how to configure the StringFunctionCleanser to transform string values during data processing.

Cleanser name - StringFunctionCleanser

Description - This cleanser alters the given text based on the specified options. It also adds an attribute with the ReltioCleanser crosswalk, based on the output mapping. Following are the specific cleanse functions under this category:

  • String value casing - Upper, lower, and title
  • String value trimming - leading/trailing spaces
  • String value padding - padding of characters set to the input attribute value
  • String value scrubbing - removal of any character
    By themselves, the following characters cannot be used for scrubbing:
    • Open square bracket - [

    • Closed square bracket - ]

    • Escape - \

    • Double quotation - "

      You can, however, use them along with the escape character, as shown below:

    • \\[

    • \\]

    • \\\\

    • \"
      Note: The caret (^) symbol must be escaped only if it is used as the first character in a pattern. For example: \^.
Mapping Input Fields - The String Function cleanser uses the given input field name and maps the name to the output field. The system doesn't validate input or output field names. You can define names for the following attributes:
Table 1. Mapping Input Fields
Cleanse Attribute NameMandatoryDescription
InputTextNo
CleanseAttribute1No
CleanseAttribute2No
Note: You cannot define the names for the OutputText attribute.
Mapping Output Fields
Table 2. Mapping Output Fields
Cleanse Attribute NameMandatoryDescription
OutputTextNo
CleanseAttribute1No
CleanseAttribute2No
Options
Table 3. String Function Cleanser Option
KeyAllowed ValuesDescription
casingUpper/Lower/TitleOptional. If no value is mentioned it does nothing.

Default: Nothing.

trimBoolean (true/false)Default: false.
padding.positionleft/right/centerDefault: left.
padding.lengthNumberDefault: 0.
padding.padCharAny characterDefault: Space( ).
scrubSupported escape sequences:
  • \b

  • \n

  • \r

  • \t

  • \f

Example: !@#$%\b.

Example: Applying a cleanse option across multiple fields

Table 4. Multi-field Examples
OptionsCleanse inputCleanse output
{"casing": "Upper"}
{
"InputText": "Work",
"Email": "Ent.One@gmail.com",
"Address1": "amr Tech park"
}
{
"OutputText": "WORK",
"Email": "ENT.ONE@GMAIL.COM",
"Address1": "AMR TECH PARK"
}
{"scrub": "!@#$"}
{
"PhoneType": "Home@Phone#",
"FirstName": "!Wa@lter",
"Organization": "@Reltio #India Pvt!. Ltd.$"
}
{
"PhoneType": "HomePhone",
"FirstName": "Walter",
"Organization": "Reltio India Pvt. Ltd."
}

Example: Using StringFunctionCleanser on a single field

This example shows how to configure and apply the StringFunctionCleanser to individual fields using different cleanse options such as casing, padding, trimming, and scrubbing. Each chain in the configuration maps one attribute to itself and demonstrates a unique cleansing behavior.

Configuration - for example:

{
  "uri": "configuration/entityTypes/HCP1",
  "cleanseConfig": {
    "infos": [
      {
        "uri": "configuration/entityTypes/HCP1/cleanse/infos/StringFunctionCleanser",
        "useInCleansing": true,
        "sequence": [
          {
            "chain": [
              {
                "cleanseFunction": "StringFunctionCleanser",
                "resultingValuesSourceTypeUri": "configuration/sources/ReltioCleanser",
                "proceedOnSuccess": true,
                "proceedOnFailure": true,
                "mapping": {
                  "inputMapping": [
                    {
                      "attribute": "configuration/entityTypes/HCP1/attributes/Name",
                      "mandatory": true,
                      "allValues": false,
                      "cleanseAttribute": "InputText"
                    }
                  ],
                  "outputMapping": [
                    {
                      "attribute": "configuration/entityTypes/HCP1/attributes/Name",
                      "mandatory": true,
                      "allValues": false,
                      "cleanseAttribute": "OutputText"
                    }
                  ]
                },
                "params": {
                  "trim": true
                }
              }
            ]
          }
        ]
      },
      {
        "uri": "configuration/entityTypes/HCP1/cleanse/infos/StringFunctionCleanser2",
        "useInCleansing": true,
        "sequence": [
          {
            "chain": [
              {
                "cleanseFunction": "StringFunctionCleanser",
                "resultingValuesSourceTypeUri": "configuration/sources/ReltioCleanser",
                "proceedOnSuccess": true,
                "proceedOnFailure": true,
                "mapping": {
                  "inputMapping": [
                    {
                      "attribute": "configuration/entityTypes/HCP1/attributes/Country",
                      "mandatory": true,
                      "allValues": false,
                      "cleanseAttribute": "InputText"
                    }
                  ],
                  "outputMapping": [
                    {
                      "attribute": "configuration/entityTypes/HCP1/attributes/Country",
                      "mandatory": true,
                      "allValues": false,
                      "cleanseAttribute": "OutputText"
                    }
                  ]
                },
                "params": {
                  "casing": "Upper"
                }
              }
            ]
          }
        ]
      },
      {
        "uri": "configuration/entityTypes/HCP1/cleanse/infos/StringFunctionCleanser3",
        "useInCleansing": true,
        "sequence": [
          {
            "chain": [
              {
                "cleanseFunction": "StringFunctionCleanser",
                "resultingValuesSourceTypeUri": "configuration/sources/ReltioCleanser",
                "proceedOnSuccess": true,
                "proceedOnFailure": true,
                "mapping": {
                  "inputMapping": [
                    {
                      "attribute": "configuration/entityTypes/HCP1/attributes/Description",
                      "mandatory": true,
                      "allValues": false,
                      "cleanseAttribute": "InputText"
                    }
                  ],
                  "outputMapping": [
                    {
                      "attribute": "configuration/entityTypes/HCP1/attributes/Description",
                      "mandatory": true,
                      "allValues": false,
                      "cleanseAttribute": "OutputText"
                    }
                  ]
                },
                "params": {
                  "scrub": "!@#$&*()<>/^"
                }
              }
            ]
          }
        ]
      },
      {
        "uri": "configuration/entityTypes/HCP1/cleanse/infos/StringFunctionCleanser4",
        "useInCleansing": true,
        "sequence": [
          {
            "chain": [
              {
                "cleanseFunction": "StringFunctionCleanser",
                "resultingValuesSourceTypeUri": "configuration/sources/ReltioCleanser",
                "proceedOnSuccess": true,
                "proceedOnFailure": true,
                "mapping": {
                  "inputMapping": [
                    {
                      "attribute": "configuration/entityTypes/HCP1/attributes/Salary",
                      "mandatory": true,
                      "allValues": false,
                      "cleanseAttribute": "InputText"
                    }
                  ],
                  "outputMapping": [
                    {
                      "attribute": "configuration/entityTypes/HCP1/attributes/Salary",
                      "mandatory": true,
                      "allValues": false,
                      "cleanseAttribute": "OutputText"
                    }
                  ]
                },
                "params": {
                  "padding": {
                    "position": "left",
                    "length": 20,
                    "padChar": "*"
                  }
                }
              }
            ]
          }
        ]
      }
    ]
  },
  "attributes": [
    {
      "uri": "configuration/entityTypes/HCP1/attributes/Name",
      "label": "Name",
      "name": "Name",
      "description": "",
      "type": "String",
      "hidden": false,
      "important": false
    },
    {
      "uri": "configuration/entityTypes/HCP1/attributes/Country",
      "label": "Country",
      "name": "Country",
      "description": "",
      "type": "String",
      "hidden": false,
      "important": false
    },
    {
      "uri": "configuration/entityTypes/HCP1/attributes/Description",
      "label": "Description",
      "name": "Description",
      "description": "",
      "type": "String",
      "hidden": false,
      "important": false
    },
    {
      "uri": "configuration/entityTypes/HCP1/attributes/Salary",
      "label": "Salary",
      "name": "Salary",
      "description": "",
      "type": "String",
      "hidden": false,
      "important": false
    }
  ]
}

Example

Table 5. Example
OptionsInput textOutput text
{
   “casing” : “Upper”
}
Text Cleanser ExampleTEXT CLEANSER EXAMPLE
{
   “casing” : “Title”
}
text cleanser exampleText Cleanser Example
{
   “padding” : 
   {
      “position”: “left”,
      “length”: 15
   }
}
"Pad Me""*********Pad Me"
{
   “padding” : 
   {
      “position”: “right”,
      “length”: 15,
      “padChar”: “*”
   }
}
"Pad Me""Pad Me*********"
{
   “padding” : 
   {
      “position”: “center”,
      “length”: 15,
      “padChar”: “*”
   }
}
"Pad Me""****Pad Me*****"
{
   “scrub” : “!@#$&*()<>/^”
}
"Scrub !this #text: /Four #4 score$ and* @seven #7 years ago!."Scrub this text: Four 4 score and seven 7 years ago.

Example: Mapping multiple input attributes to separate outputs

This example shows how to use the StringFunctionCleanser to trim and copy three attributes — Classification, FacilityType, and Specialty — to distinct output attributes in a nested structure.

Cleanser configuration

{
  "uri": "configuration/entityTypes/Account/cleanse/infos/ClassofTradeNCOTValueBuilder",
  "useInCleansing": true,
  "sequence": [
    {
      "chain": [
        {
          "cleanseFunction": "StringFunctionCleanser",
          "resultingValuesSourceTypeUri": "configuration/sources/ReltioCleanser",
          "proceedOnSuccess": true,
          "proceedOnFailure": true,
          "mapping": {
            "inputMapping": [
              {
                "attribute": "configuration/entityTypes/Account/attributes/ClassofTradeNCOT/attributes/Classification",
                "cleanseAttribute": "Classification"
              },
              {
                "attribute": "configuration/entityTypes/Account/attributes/ClassofTradeNCOT/attributes/FacilityType",
                "cleanseAttribute": "FacilityType"
              },
              {
                "attribute": "configuration/entityTypes/Account/attributes/ClassofTradeNCOT/attributes/Specialty",
                "cleanseAttribute": "Specialty"
              }
            ],
            "outputMapping": [
              {
                "attribute": "configuration/entityTypes/Account/attributes/ClassofTradeNCOT/attributes/GlobalClassification",
                "cleanseAttribute": "Classification"
              },
              {
                "attribute": "configuration/entityTypes/Account/attributes/ClassofTradeNCOT/attributes/GlobalFacilityType",
                "cleanseAttribute": "FacilityType"
              },
              {
                "attribute": "configuration/entityTypes/Account/attributes/ClassofTradeNCOT/attributes/GlobalSpecialty",
                "cleanseAttribute": "Specialty"
              }
            ]
          },
          "params": {
            "trim": true,
            "isForce": true
          }
        }
      ]
    }
  ],
  "nestedAttributeToCleanse": "configuration/entityTypes/Account/attributes/ClassofTradeNCOT"
}

Input and output example

Table 6. Cleanse input and output with multi-attribute mapping
OptionsCleanse inputCleanse output
{"trim": true, "isForce": true}
{
  "Classification": " Retail ",
  "FacilityType": " Clinic ",
  "Specialty": " Oncology "
}
{
  "GlobalClassification": "Retail",
  "GlobalFacilityType": "Clinic",
  "GlobalSpecialty": "Oncology"
}