Wednesday, July 22, 2009

Displaying data from more than one list- Joined subview in SharePoint designer

When we works with sharepoint designer, generally DataView is used to display content from sharepoint lists/libraries. We can easily display contents from a single list. But what if we have to display contents from multiple lists? Dataview has ability to display data from multiple lists. We need to create new data source which will have data from multiple lists. We need to follow some steps to accomplish this-
1. open the site from sharepoint designer.
2. Select data source library from right task pane and and then click on 'create a new linked source'. Below is the screen shot-


3. In data source properties dialogue box, click on configure linked source.
4. A new box will appear as below. Select the lists/library that you want to link and then click on next.



5. In the linked data source wizard, there will be two options- merging and joining. Now select the second option i.e. join the contents and then click finish and then Ok. Below is the screen shot-

Now our data source has been created.

6. Now open the page where you want to display the data. Add a dataview control from dataview menu to the content region.

7. Now click on newly created data source and then select show data as below-

8. After clicking on show data, it will display all the columns in the data source. select the columns from first list which you want to display on dataview. Drag and drop the selected column to the dataview control-

9. The selected column will be inserted in dataview inside TD tag. Now suppose you wants to display data from second list on the right. Then right Click on TD in designer and then select insert cell to the right as below-



10. Now Select the desired columns from second list and then select "insert as joined subview" from top as below-



11. A join subview dialog box will be open. Here we will columns from the two list which have matching data as here I used ID column-



After selecting the column click on Ok. Now the selected column will be inserted in the newly created TD tag.

Its done now. It will display data from the two list based on the value of matching column. The look and feel of the subview might not be perfect but it can be updated by doing a little modification in HTML which is generated for the joined subview and by applying custom CSS classes.






2 comments:

  1. i get the 2nd list column headers repeatedly. how should i correct that ?

    ReplyDelete