How can ignore leading zeros in a match rule?

Question

I have a string field, but sometimes the data contains proceeding zeros and sometimes it does not.  I am trying to build a match rule to just match the field based on numeric values without changing the type from string.  Can someone help me with this?  e.g. 000723 should match 723.  When I use the RangeNumericComparator it gives a validation error and says the field type is not correct and will not let me save the L3 / new rule.
{
  "exact": [
    "configuration/entityTypes/MedicinalProduct/attributes/NDC"
  ],
  "comparatorClasses": {
    "mapping": [
      {
        "attribute": "configuration/entityTypes/MedicinalProduct/attributes/NDC",
        "class": "com.reltio.match.comparator.RangeNumericComparator"
      }
    ]
  },
  "matchTokenClasses": {
    "mapping": [
      {
        "attribute": "configuration/entityTypes/MedicinalProduct/attributes/NDC",
        "class": "com.reltio.match.token.RangeNumericMatchToken"
      }
    ]
  }
}

Is there pattern to ignore leading zero?

Answer

Please review the following for a solution to the problem.

 

"parameters": [
            {
                "parameter": "groups",
                "values": [
                    {
                        "pattern": "[^0]*[1-9][0-9]*",
                        "className": "com.reltio.match.token.ExactMatchToken"
                    }
                ]
            }
        ],
        "class": "com.reltio.match.token.CustomMatchToken"

Example of Match Rule:

{
  "exact": [
    "configuration/entityTypes/MedicinalProduct/attributes/NDC"
  ],
  "matchTokenClasses": {
    "mapping": [
      {
        "attribute": "configuration/entityTypes/MedicinalProduct/attributes/NDC",
        "parameters": [
          {
            "parameter": "groups",
            "values": [
              {
                "pattern": "[^0]*[1-9][0-9]*",
                "className": "com.reltio.match.token.ExactMatchToken"
              }
            ]
          }
        ],
        "class": "com.reltio.match.token.CustomMatchToken"
      }
    ]
  },
  "comparatorClasses": {
    "mapping": [
      {
        "attribute": "configuration/entityTypes/MedicinalProduct/attributes/NDC",
        "parameters": [
          {
            "parameter": "groups",
            "values": [
              {
                "pattern": "[^0]*[1-9][0-9]*",
                "className": "com.reltio.match.token.BasicStringComparator"
              }
            ]
          }
        ],
        "class": "com.reltio.match.comparator.CustomComparator"
      }
    ]
  }
}
Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.