Share - Manage - Govern
ABOUT BLOG RSS CONNECT WITH RENE RSS RSS Feed
15. May 2009  

Recently, I wanted to display some small statistics about how often people participated in the discussions in a SharePoint discussion board. I wanted to show the total number of postings in a small web part. The solution for this requires SharePoint Designer, as it makes use of the Data View Web Part.

I'll show the steps to display the list of people who participated in a discussion board and their total number of postings from the beginning:
First, I create a new blank site and add a discussion board:
Discussion Board Postings

I open the site in SharePoint Designer and add a Data View Web Part into the right web part zone. In the Data Source Library to the right, I select the discussion board, and then Show Data:
Discussion Board Postings

Right now, only the discussion topics are contained in the rows returned, but not all postings. To change this, click on the name of your Data Source, in my case Discussion Board:
Discussion Board Postings

In the following dialog, select RecursiveAll under Item and folder scope:
Discussion Board Postings


Next, select Created By (if wanted also additional fields), and choose Insert Selected Fields as.... Multiple Item View. The Data View Web Part is now populated with the selected fields.


In the Data View Web Part, select Sort and Group from its menu:
Discussion Board Postings

Sort by Created By, and select Show group header and Collapse group by default:
Discussion Board Postings

You will get something similar to the left part of the following image:
Discussion Board Postings
I then removed the unnecessary parts as seen in the image above, and added a new column for the number of postings. 


Click inside the cell underneath Postings, and in the source code add the following line into it:

<xsl:value-of select="count($nodeset)" />


Next we need to change the query fetching the rows. Find the following line 

<xsl:with-param name="nodeset" select="msxsl:node-set($dvt_Rows)/root//Row[((@Author)=$groupheader0 or ((not(@Author) or @Author='') and $groupheader0=' '))]" />

and replace it with 

      <xsl:with-param name="nodeset" select="msxsl:node-set($dvt_Rows)/root//Row[substring-before(substring-after(string(@Author),'userdisp.aspx?ID='),'&quot;')=substring-before(substring-after(string($groupheader0),'userdisp.aspx?ID='),'&quot;')]" />

 

That's it, the result will look like this:
Discussion Board Postings

 

The drawback at the moment here is that it doesn't sort by the number of Postings, which I haven't found out (yet) how to do. 

Comments
Nick Kharchenko says:
(01 Aug 2010, 11:50)

MAPILab provides a very good SharePoint usage reporting solution: MAPILab Statistics for SharePoint. Detailed reports on visitors, documents, lists, search, etc. You can try its free trial version, or look through the online demo: http://www.mapilab.com/sharepoint/statistics/.

Add comment













authimage

Bold Italic Link