How can I populate/cleanse an attribute based on the information that resides in another attribute? What is the PatternBasedFieldBuilder cleanser?

Question

 

We have an HCP configuration that includes two attributes. We are loading the attribute from a source, we want to know if there is a cleanse configuration to populate the one attribute based on the other attribute that we receive from a source.

 

Answer

Use the PatternBasedFieldBuilder cleanser to achieve this type of action.

pattern

Inputs (In)

Name (Out)

{ “isForce: true,
   “pattern”: I, “{FirstName} {LastName}, live in {Country}”
}
{
"FirstName": "Walter",
"LastName": "Bruce"
"Country": "USA"
}
I, Walter Bruce, live in USA
{ “isForce: false,
   “pattern”: “{Address1}, {City}, {Country} - {PostalCode}”
}
{
"Address1": "100 MAIN ST
",
"City": "SEATTLE WA
",
"Country": "USA
",
"PostalCode": "98104
"
}
100 MAIN ST, SEATTLE WA, USA - 98104
  • Adding this cleanser to the physical configuration is optional.
{
  "cleanseFunction": "r",
  "options": {
    "isForce": false
  }
}
  • You map this cleanser for any entity in your L3 business configuration.
{
"uri": "configuration/entityTypes/HCP2",
"cleanseConfig": {
"infos": [
{
"uri": "configuration/entityTypes/HCP2/cleanse/infos/PatternBasedFieldBuilder",
"useInCleansing": true,
"sequence": [
{
"chain": [
{
"cleanseFunction": "PatternBasedFieldBuilder",
"resultingValuesSourceTypeUri": "configuration/sources/ReltioCleanser",
"proceedOnSuccess": true,
"proceedOnFailure": true,
"mapping": {
"inputMapping": [
{
"attribute": "configuration/entityTypes/HCP2/attributes/Name",
"mandatory": false,
"allValues": false,
"cleanseAttribute": "Name"
},
{
"attribute": "configuration/entityTypes/HCP2/attributes/Organization",
"mandatory": false,
"allValues": false,
"cleanseAttribute": "Organization"
},
{
"attribute": "configuration/entityTypes/HCP2/attributes/Country",
"mandatory": false,
"allValues": false,
"cleanseAttribute": "Country"
}
],
"outputMapping": [
{
"attribute": "configuration/entityTypes/HCP2/attributes/ShortNote",
"mandatory": true,
"allValues": false,
"cleanseAttribute": "OutputText"
}
]
},
"params": {
"isForce": true,
"pattern": "{Name}, {Organization} - {Country}"
}
}
]
}
]
}
]
},
"attributes": [
{
"uri": "configuration/entityTypes/HCP2/attributes/Name",
"label": "Name",
"name": "Name",
"description": "",
"type": "String",
"hidden": false,
"important": false
},
{
"uri": "configuration/entityTypes/HCP2/attributes/Country",
"label": "Country",
"name": "Country",
"description": "",
"type": "String",
"hidden": false,
"important": false
},
{
"uri": "configuration/entityTypes/HCP2/attributes/Organization",
"label": "Organization",
"name": "Description",
"description": "",
"type": "String",
"hidden": false,
"important": false
},
{
"uri": "configuration/entityTypes/HCP2/attributes/ShortNote",
"label": "ShortNote",
"name": "ShortNote",
"description": "",
"type": "String",
"hidden": false,
"important": false
}
]
}
  • The input sample for an HCP entity.
[
{
"type": "configuration/entityTypes/HCP2",
"attributes": {
"Name": [
{
"value": "Walter"
}
],
"Country": [
{
"value": "India"
}
],
"Organization": [
{
"value": "Reltio"
}
]
}
}
]
  • The following response will result in the entity's record.
"attributes": {
"Name": [
{
"type": "configuration/entityTypes/HCP/attributes/FirstName",
"ov": true,
"value": "Walter",
"uri": "entities/0N1ubq4/attributes/FirstName/2xE6FgXI"
}
],
"Country": [
{
"type": "configuration/entityTypes/HCP/attributes/MiddleName",
"ov": true,
"value": "India",
"uri": "entities/0N1ubq4/attributes/MiddleName/2xE6Fp3o"
}
],
"Organization": [
{
"type": "configuration/entityTypes/HCP/attributes/LastName",
"ov": true,
"value": "Reltio",
"uri": "entities/0N1ubq4/attributes/LastName/2xE6FknY"
}
],
"ShortNote": [
{
"type": "configuration/entityTypes/HCP/attributes/Initial",
"ov": true,
"value": "Walter, Reltio - India",
"uri": "entities/0N1ubq4/attributes/Initial/2xE6GzWC"
}
]
},

 

 

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.