Forum Discussion
F0RCE
Sep 16, 2022Copper Contributor
Sharepoint Server 2019 double validation (minimum amount of characters or certain character in field
Hello,
I am using validation in my Sharepoint Server 2019 survey:
=LEN([Field1])>=6
It force a single line text field to have at least 6 digits But I need to add OR statement. I need to allow this field to have either 6 digits or value "-" to pass.
Logic behind this is that people can either write a text in this field or leave it blank. But I need them to write "-" by themselves cause otherwise they will make a lot mistakes by leaving blank fields. I need fail proof solution.
I tried multiple OR solutions but it all failed ๐
Thank you!
F0RCE Use this formula:
=OR([Field1] = "-", LEN([Field1])>=6)
Note: Sometimes comma(,) does not work in formula (it is based on language or regional settings of your site). So in that case use semicolon(;) instead of comma(,).
Documentation: examples-of-common-formulas-in-lists
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
- F0RCECopper Contributor
It shows that I cannot refer to different column but I am reffering to the same.
Column name is (a survey question):
"II. Programming for IT Business"
Column name in URL at edit page:
"II_x002e__x0020_Programming_x0"
I am using it like that:
=OR([II_x002e__x0020_Programming_x0] = "-";LEN([II_x002e__x0020_Programming_x0])>=6)
=OR([II. Programming for IT Business] = "-";LEN([II. Programming for IT Business])>=6)
Am I doing something wrong?
When I try to do this from validation menu (not in a question but general menu) it shows that I refer to not existent column....
F0RCE I just tried it on my SharePoint site and it works fine for me. Formula used:
=OR([II. Programming for IT Business]="-",LEN([II. Programming for IT Business])>=6)
Column settings:
Output:
Try using correct and exact display name of column. Make sure you are using spaces correctly also check case sensitivity (capital/small letters) of column name.
Did you also try using comma instead of semicolon? Or your site works with semicolons only?
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
- F0RCECopper ContributorPlease help ๐