We can associate a View for a List. Views provide a different representation of the existing information. If a List has columns Name and Country we can create a View for the List with county as India. Here we are experimenting with custom column creation as well.
For this create a new List with Custom List as the template.
Add the following columns into it.
Now add the following data into the Contacts List
Now there are 2 records with India and Other as country.
From the List ribbon item and click Create View button.
In the appearing page select Standard View option.
In the appearing page, enter the name for the view as Contacts in India.
Scroll down and in the Filter section use Country as filter equal to India.
Click the Ok button to create the View. Now you can see the view only lists one record.
This concludes our View creation.
Note: Views can be used to show grouped data, filtered data etc. based on the existing Lists items. In this way it is similar to the database Views which operate on tables. In SharePoint the contents are getting stored in SQL Server database.
A column in a List can integrate with another List column. For example we have 2 lists.
Doctor (Referring to Doctor.Name column)
Here the Patient List is referring to Doctor List through the Doctor column which is acting as a Lookup column.
To accomplish the same create a custom list named Doctors with Name and Qualification as columns.
Note: The Title column will be already there, renaming/deleting can be done through the List Settings screen.
Now create a new list named Patients using Custom List template. Add the properties Name, Address and Doctor. For the column Doctor choose Lookup field.
Choose the highlighted list items as shown in the screen above. The Lookup field is required to fetch data from other Lists. We need to specify the List and Column for Lookups.
After setting the Lookup properties click the Ok button.
Now add some data to the Doctors list as shown below:
Now use the Add new item for the Patients List. You will be able to see the Doctor lookup field auto populated from the Doctors List.
Enter the details and click Save button. You are ready with the Patient with Doctor as Lookup value.
So this concludes our experiment with Lookup values. In real life scenarios we will end up with multiple Lookup values and validations. The Lookup values are implemented using Relationships. It is similar to the foreign key relations of a Relational Database Management System like SQL Server.
We can add validations for the columns. Now we can start experimenting with them. Here we are starting with a List of Employees. The columns are:
Make sure that the Age column is in the range 18 to 100. Any out of range values should populate the error message “Invalid Age – Please enter a value between 18 and 100!”
Create a List from the Custom List template and name it as Employees. Add custom column Name and Age. For the Age column make the type as Number. In the Column Validation section at bottom enter the following properties.
User Message: Invalid Age – Please enter a value between 18 and 100!
Click the Ok button to continue. Now the List is ready with Name and Agecolumns.
Try to add a new item into the list with an invalid age (age = 11 for example)
You can see that the error message is shown for invalid Age.
This concludes our experiment with validations. In real world scenarios more complex validations need to be performed. For reference on the formulas you can use the link provided in the References section of this article.
In this article we have learnt about Views, Lookups and Validations. These knowledge are needed in building real world record management systems using SharePoint 2010.