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 characterBy 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: \^.
-
Cleanse Attribute Name | Mandatory | Description |
---|---|---|
InputText | No | |
CleanseAttribute1 | No | |
CleanseAttribute2 | No |
OutputText
attribute.Cleanse Attribute Name | Mandatory | Description |
---|---|---|
OutputText | No | |
CleanseAttribute1 | No | |
CleanseAttribute2 | No |
Key | Allowed Values | Description |
---|---|---|
casing | Upper/Lower/Title | Optional. If no value is mentioned it does nothing. Default: Nothing. |
trim | Boolean (true/false) | Default: false. |
padding.position | left/right/center | Default: left. |
padding.length | Number | Default: 0. |
padding.padChar | Any character | Default: Space( ). |
scrub | Supported escape sequences:
| Example: !@#$%\b. |
Example: Applying a cleanse option across multiple fields
Options | Cleanse input | Cleanse output |
---|---|---|
{"casing": "Upper"} |
|
|
{"scrub": "!@#$"} |
|
|
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
Options | Input text | Output text |
---|---|---|
| Text Cleanser Example | TEXT CLEANSER EXAMPLE |
| text cleanser example | Text Cleanser Example |
| "Pad Me" | "*********Pad Me" |
| "Pad Me" | "Pad Me*********" |
| "Pad Me" | "****Pad Me*****" |
| "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
Options | Cleanse input | Cleanse output |
---|---|---|
{"trim": true, "isForce": true} |
|
|