Regex not working in calculation field
Any ideas why I get this error? The field I'm using for 'mapValue' is a calculation field that is a full address. No clue how to fix this.
-
Hey Russell,
Instead of returning match1[0] directly, when Podio injects your code with sample field value, the error occurs because when regex is executed nothing found returns null and you're trying to directly access an array which might not be returned, in this case your sample test value that Podio injects when validating a calc field.
so instead of using this match1[0] use this:
return match1 && match1.length>0 ? match1[0] : "not found";this will ensure that if match1 exists and is an array with length greater than 0, if it is then it's going to return the first match else it'll return not foundNote: Also please make sure you use mapValue.toString() to convert it to a valid string if not alreadyLet me know how that goes!
Please sign in to leave a comment.
Comments
2 comments