Error with Transform

I have create a Transform that is throwing an error:

There was an exception while calculating the value for this attribute. Error during transformation for attribute: cfsalesforcealias (Transform ID: Calculate cfsalesforcealias) Cause: An empty regex expression may not be used for target value:

{
    "name": "Calculate alias",
    "type": "substring",
    "attributes": {
        "begin": 0,
        "end": 8,
        "input": {
            "type": "replaceAll",
            "attributes": {
                "table": {
                    " ": ""
                },
                "input": {
                    "type": "accountAttribute",
                    "attributes": {
                        "sourceName": "HR",
                        "attributeName": "Display_Name"
                    }
                }
            }
        }
    },
    "internal": false
}

I’m sure the fix is obvious. Any help would be appreciated.

{
  "name": "Calculate alias",
  "type": "substring",
  "attributes": {
    "begin": 0,
    "end": 8,
    "input": {
      "type": "replace",
      "name": "Remove Spaces",
      "attributes": {
        "regex": "\\s+",
        "replacement": "",
        "input": {
          "type": "accountAttribute",
          "name": "Get Display Name",
          "attributes": {
            "sourceName": "HR",
            "attributeName": "Display_Name"
          }
        }
      }
    }
  },
  "internal": false
}

Can you try above please. Thanks

Hi @vic_rinkenberger , are you trying to calc alis out of display name attribute right without any spaces of 0-8 chars

Can you try below

{"name": "Calculate alias",
"type": "substring",
"attributes": {
    "begin": 0,
    "end": 8,
    "input": {
        "type": "replace",
        "name": "Remove Spaces",
        "attributes": {
            "regex": " ",
            "replacement": "",
            "input": {
                "type": "accountAttribute",
                "name": "Get Display Name",
                "attributes": {
                    "sourceName": "HR",
                    "attributeName": "Display_Name"

               }
           }
       }
   }
}

Thanks ,

Avinash Mulpuru

Fixed: Replace hardcoded two whitespaces with “\\s+" in replaceAll transform.

The issue wasn’t with the transform structure, but with how replaceAll was being used.

the transform was using a hardcoded two-space pattern instead of a regex pattern for whitespace matching. “\\s+" matches one or more consecutive whitespace characters.

Thanks! This worked.

replaceAll with “\\s+” works in this case. However, as clean solution I’d use replace because it have only one pattern to remove. if there are multiple replace operations patterns replaceAll with table of key-value pairs would better. Thanks