Hi all,
I’m Darshan Hiranandani, working with a formula that uses RegEx to extract a 7-digit number from the Description field, but I’m running into an error: "Parse: Error at Char (109): Formula tried to apply string operator to Numeric value (EndsWith)."
Here’s the formula I’m working with:
if StartsWith([Description], RegEx_Match([Description], ".*\d{7}.*"))
then Left([Description], 7)
Elseif EndsWith([Description], RegEx_Match([Description], ".*\d{7}.*"))
then Right([Description], 7)
elseif Contains([Description], "Supplemental")
then "Supplemental"
elseif contains([Description],"Nevada")
then "Nevada Modified Business Tax"
else "No Description"
endif
Problem:
Some Sample Data:
My goal:
I’m wondering if I’m overcomplicating things with the regular expression or the logic in my formula. Does anyone have suggestions for simplifying this or fixing the error?
Any help would be much appreciated!
Regards
Darshan Hiranandani
Regards
Darshan Hiranandani
I used your code and rewrote it as following. regex_match returns true or false, not string.
if RegEx_match([Description], "^\d{7}.*")
then Left([Description], 7)
elseif RegEx_match([Description], ".*\d{7}$")
then Right([Description], 7)
elseif Contains([Description], "Supplemental")
then "Supplemental"
elseif contains([Description],"Nevada")
then "Nevada Modified Business Tax"
else "No Description"
endif