Monday 7 July 2014

Column Validation in SharePoint 2010

Column Validation in SharePoint 2010
Steps:
1. Create a new column on a list, and click “Column Validation” in the same page.
2. Add a validation Formula, and a message that will display if validation fails.
Example:
Column name is: Country
In the Column Validation”:
formula should be [Country]=”India”
User message: The value should be “India”
If user enters other than India for Country column user will get error message: The value should be “India”
We can add more validation from “Validation Settings”
GO to list–>List Settings–>”Validation Settings”
Here Enter a validation formula to apply to this list. Click Save

Date Validation:
Create 2 date columns. Start date and end date.
Example: Create 2 columns: Start Date and End Date
Go to list–>List Settings–>”Validation Settings”
Select “Start Date” click Add to formula
then add formula
Formula:
= [end date]>[ Start date]
Error: Start date should not be more than End date
Range Validation:
Create a column
Name:  Age
Type: number
Add a validation:
=[Age]>=20
Error message: Age should be more than 20 years



Or: if you want 0 to 100
Formula:
=AND(Age>0,Age<=100)
Error message: Age should be between 0 and 100
Compare validate:
Create a column with name Country, type as string
Formula[Country] =”India”, Error message: Value must be ‘India’