0

My users would like to enter a value in the NAME attribute of an entity in SQL Server Master Data Services. The valid values must contain zero to six characters. NULL is a valid value.

I have written a validation rule with a action containing a regex to ensure that the value is six or less characters (Name must contain the pattern ^.{0,6}$), but the NULL values get flagged with a "Validation Failed" status. I would like the NULL values to pass the validation test. Is there a way to do this?

Thanks for your time. I appreciate your help.

jarlh
  • 42,561
  • 8
  • 45
  • 63
Kaye Cahs
  • 1
  • 1

2 Answers2

0

I found the answer to my question on another site. I tested it, and it works.
Here it is:

Conditions: If MyAttribute contains the pattern .* Actions: Then MyAttribute must contain the pattern ^.{0,6}$

Thanks

Kaye Cahs
  • 1
  • 1
  • i am 100% sure there is nowhere where this will compile. This is not an answer, but then again, the question is also very very vague – GuidoG Feb 13 '18 at 15:34
  • @GuidoG: You are correct. It will not compile. The MDS validation rules are configured via a drag-and-drop interface. I cannot post the actual code here unless I post a screenshot. I chose instead to represent the working configuration with pseudo-code. Sorry for the confusion. – Kaye Cahs Feb 14 '18 at 18:23
0

Add an "OR Name IS NULL" to the validation rule.

Davide Pizzolato
  • 679
  • 8
  • 25