Getting error in the code

I need to remove all the spaces as well as to decompose the diacritical marks from the input from the following code but it’s not working and getting the error as (There was an exception while calculating the value for this attribute. Error during transformation for attribute: lname (Transform ID: NELMlastname without spaces) Cause: An empty regex expression may not be used for target value:)

{
“id”: “********************”,
“name”: "Remove spaces and decompose diacriticalmarks ",
“type”: “replaceAll”,
“attributes”: {
“table”: {
" ": “”
},
“input”: {
“type”: “decomposeDiacriticalMarks”,
“attributes”: {
“input”: {
“attributes”: {
“sourceName”: “Non-Employee”,
“attributeName”: “lastName”
},
“type”: “accountAttribute”
}
}
}
},
“internal”: false
}

Any help would be greatly appreciated!!!

Try the below logic


{
  "id": "********************",
  "name": "Remove spaces and decompose diacritical marks",
  "type": "replaceAll",
  "attributes": {
    "table": {
      "\\s+": ""
    },
    "input": {
      "type": "decomposeDiacriticalMarks",
      "attributes": {
        "input": {
          "attributes": {
            "sourceName": "Non-Employee",
            "attributeName": "lastName"
          },
          "type": "accountAttribute"
        }
      }
    }
  },
  "internal": false
}

Here’s what has been modified:

  • In the table attribute of the replaceAll transform, the key has been changed from " " to "\\s+". This regex expression "\\s+" matches one or more whitespace characters, including spaces, tabs, and line breaks. It will replace all occurrences of whitespace characters with an empty string, effectively removing them.
  • The input attribute remains the same, using the decomposeDiacriticalMarks transform to decompose the diacritical marks from the input lastName attribute.

With these changes, the transform should remove all spaces and decompose the diacritical marks from the input lastName attribute without encountering the regex expression error.

3 Likes

@ts_fpatterson Thank you very much for the quick response. This worked for our scenario.

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.