Relational Lists in SharePoint 2010
Posted
Monday, October 19, 2009 5:10 PM
by
CoreyRoth
In WSS3, there really was no supported way to do relational lists. Most of us just used lookup columns and we sort of got by. Of course there was no included support for maintaining referential integrity unless we included it ourselves. SharePoint 2010 really takes this up a notch with some nice new features. It also starts with the use of Lookup Columns.
When you go to create a lookup column, you will see that there are a few new options. We still set the list we want (sorry no cross-site support in the UI still) and a value field. However, there is a new option to maintain referential integrity at the bottom of the page. Here it gives us the option to cascade delete from the parent list to the child list or to simply prevent the delete if any child items still exist.
That’s not all though! Often times in the child list, we would like to see data from the parent list. For example, we’re viewing invoices and we want to see the actual name of the custom on the invoice and not just the Id. In the pervious version, this required us to implement custom code to query the list and use LINQ or whatever to make a join. Fyi, CAML now supports joins, but you probably don’t care because you’ll never use it again due to LINQ to SharePoint. What is very cool is that it displays a list of site columns from the parent list and will show them on the child list for use in views, etc. This makes it very easy to produce a good experience to the user out of the box when working with this type of data.