Wednesday, December 22, 2010

Sharepoint Foundation 2010 - Create linked lists with header detail display

This will show how to create a header-detail relationship in SharePoint Foundation 2010.  In this tutorial, we will be creating a Orders/ OrderDetails relationship.

Let’s get started:
  1.       We need to create 2 lists and link them together.
a.       Create Orders list
b.      Site Actions > View All Site Content
c.       Click “Create”
d.      Select “Custom List”
e.      Give the list a name, let us call it “Orders”
f.        Click “Create”
g.       After page reloads, click “List Settings” top right on ribbon bar
h.      Scroll down to columns, click “Title” column, so that we can edit it.
i.         (make sure “Enforce unique values is set to YES)
j.         Rename column to “OrderNumber”
k.       Click “OK”
l.         Now click “Create column”
m.    Column Name: “OrderDate”, type = “Date And Time”
n.      Click “OK”

a.       Create OrderDetails  list
b.      Site Actions > View All Site Content
c.       Click “Create”
d.      Select “Custom List”
e.      Give the list a name, let us call it “OrderDetails  ”
f.        Click “Create”
g.       After page reloads, click “List Settings” top right on ribbon bar
h.      Scroll down to columns, click “Title” column, so that we can edit it.
i.         (make sure “Enforce unique values is set to NO)
j.         Rename column to “Qty”
k.       Click “OK”
l.         Now click “Create column”
m.    Column Name: “Product”, type = “Single Line of Test” (Could also be a lookup)
n.      Click “OK”
o.      Again,  click “Create column”
p.      Column Name: “OrderNumber”, type = “Lookup (information already on this site)”
q.      Get information from, select “Orders”
r.        In this column, select “OrderNumber”
s.       (There is the relationship behaviour which can help to maintain data integrity, but it outside of the scope of this quick tutorial)
t.        Click “OK”

2.       Create an  order  and add some orderdetails.  Make sure you select the ordernumber you created in orders when adding orderdetails.

3.       Select Orders from the lists.

4.       Select Site Actions > Edit Page

5.       Under Web Part Tools, select Options

6.       Select Insert related List, click “Orderdetails”



7. Now you have setup a header detail relartionship.



ORD002 selected, showing 0 line items in order detail

ORD001 selected, showing 2 line items in order detail

No comments:

Post a Comment