Archive for April, 2010

Document library matrix

April 5, 2010


Some days ago I had a discussion with my management about the usability of Sharepoint as a document management system. My management tried using a document library to publish internal product management but found that the folder functionality in MOSS 2007 is not efficient, my initial response to them was not to use folders but to use metadata which allows describing the items in multiple dimensions. I always try and suggest to avoid folders, except if you want to apply different permissions on a lower level in the library.

So, they went on and inserted documents in the library and tagged them in 2 columns (product and document type) based on selection lists. But then the management wanted to know, with a blink of an eye, the products which were missing documents. Well… building a view with a group on product and document type did not give the result they were looking for because you can’t group on non-existing values. In our “other” document management system they used a folder structure and had an item count on the level of the folder… but Sharepoint does not do this.

Their conclusion:  Sharepoint is not usable for managing documents and we will potentially not be able to migrate our “other” document management systems into Sharepoint.

I proposed them to make a matrix view, as below sketch, on top of the document library which shows what document types exist or does not exist for what product.

  doc type x doc type y doc type z
 product x  v    v
 product y    v  
 product z      

Tools I used: Notepad, jQuery, MSDN


  1. If not yet done, upload the latest jQuery library (jquery-1.4.2.min.js) to a document library on the Sharepoint server.
  2. Add a Content Editor Webpart to a Sharepoint page and paste the Javascript code from my skydrive  in it
  3. Modify the url to the jquery library (<script src=”http://sp2007/Documents/jquery.js”></script>)
  4. Set the variables to match your environment
            var ColumnField = “ContentType”; //list column name to put in the columns
            var RowField = “Product”; //list column name to put in the rows
            var SiteURL = “http://sp2007/Docs“; // url to the site where the library is located
            var DocLibrary = “Documents”; //name of the document library
            var DocLibraryURL = “http://sp2007/Docs/Documents/Forms/AllItems.aspx“; //full url to the view which should loaded when a cell is clicked
            var ShowItemCount = true; //true or false, this will show an item count in the cell
            var ShowMissingHeader = true; //true or false, to show items which do not have both fields filled
  5. Tip: also add the same content query webpart with same source on the document library view page. To do so:
    – go to your document library
    – add the following string to the URL ?ToolPaneview=2– now you can execute step 2-4 on this page

Some pictures

The below picture shows the demo data which is used in this post (Product field and Content Type)

The below picture shows the matrix

The below pictures shows the matrix when used on the doc library view screen, with an active filter

This matrix approach convinced them of adding metadata to their documents. Now up to the next challenge in optimizing our environment and reducing the number of systems to do the same task.