Document library view: Group by a column with multiple values

I have a document library which has a managed metadata column.
I would like to create a view which groups the documents by this managed metadata column.
The managed metadata column can have multiple values.
I know that this is not possible with SharePoint's group by, since it only accepts those columns which can have only one single value.
But is this possible to accomplish by some other means, e.g. Content query web part? Or is there perhaps a 3rd party solution to this?
Is it possible to change the group by settings somehow to allow Group by to function with columns with multiple values? <- this may be far fetched...

Hi Pekch,
I'm assuming you have VS2010 to build the custom web part. From there you will need to figure out the following:
Get a SPList object for the Document Library (See below for code example)
Loop through all the documents in the SPList object 
If you have audience targetting enabled, then you'll need to determine if the user has access to the document by checking the "Target_x0020_Audiences" column)
As you also want to group by metadata, you'll need to populate 2 datatables (one table with a column containing unique metadata values and another table with a metadata column and other document related columns).  Link these two tables via a dataset
relation.
Set the dataset as the datasource for a repeater, add in some css and javascript for the group expand/collaspe and it should be close to what you need.
This will be a time consuming task if you don't know where to start or have problems figuring out how to perform a certain operation.  So you may want to determine if the functionality you want is required or just a "nice to have".  Good
luck and if I have some spare time, I'll create a blog post outlining how to do all the above.
I got the below code from a sharepoint blog sometime in the past and you can use it to retrieve a list.
You can use it like this: GetListByUrl(http://servername/Shared%20Documents/Forms/AllItems.aspx)
using    Microsoft.SharePoint;
public SPList GetListByUrl(string listURL)
SPList list = null;
try
using (SPSite site = new SPSite(listURL))
if (site != null)
// Strip off the site url, leaving the rest
// We'll use this to open the web
string webUrl = listURL.Substring(site.Url.Length);
// Strip off anything after /forms/
int formsPos = webUrl.IndexOf("/forms/", 0, StringComparison.InvariantCultureIgnoreCase);
if (formsPos >= 0)
webUrl = webUrl.Substring(0, webUrl.LastIndexOf('/', formsPos));
// Strip off anything after /lists/
int listPos = webUrl.IndexOf("/lists/", 0, StringComparison.InvariantCultureIgnoreCase);
if (listPos >= 0)
// Must be a custom list
// Strip off anything after /lists/
webUrl = webUrl.Substring(0, webUrl.LastIndexOf('/', listPos));
else
// No lists, must be a document library.
// Strip off the document library name
webUrl = webUrl.Substring(0, webUrl.LastIndexOf('/'));
// Get the web site
using (SPWeb web = site.OpenWeb(webUrl))
if (web != null)
// Initialize the web (avoids COM exceptions)
string title = web.Title;
// Strip off the relative list Url
// Form the full path to the list
//string relativelistURL = listURL.Substring(web.Url.Length);
//string url = SPUrlUtility.CombineUrl(web.Url, relativelistURL);
// Get the list
list = web.GetList(listURL);
catch { }
return list;

Similar Messages

  • Count the items in a column with multiple values?

    Hi all
    Is there a way to count the items in a column that allows multiple values?
    Example list:
    Course title:                        Participants:
    Visual Basic Introduction     John Smith; Lois Lane; Clark Kent
    Visual Basic Advanced         John Smith; Lex Luthor
    The result should be "3" and "2" (number of participants), which should be displayed in the list or on the page.
    Is this possible?
    ( I am using Sharepoint 2007 and have access to Sharepoint designer.)
    Thanks!

    Hi dee,
    We can use XSLT to do this in Data View Web Part.
    First, display your list in data view web part.
    Insert a new column in the data view, used to display the count.
    Switch to code mode, add following code within the <td></td>.
    <td>
    <xsl:choose>
    <xsl:when test="@Title!=''">
    <xsl:variable name="count">
    <xsl:call-template name="countChar">
    <xsl:with-param name="str" select="@Title" />
    <xsl:with-param name="count" select="1" />
    </xsl:call-template>
    </xsl:variable>
    count is <xsl:value-of select="$count" />
    </xsl:when>
    <xsl:otherwise>
    count is <xsl:value-of select="0" />
    </xsl:otherwise>
    </xsl:choose>
    </td>
    And put the following template definition outside all the other templates.
    <xsl:template name="countChar">
    <xsl:param name="str" />
    <xsl:param name="count" />
    <xsl:choose>
    <xsl:when test="contains($str, ';')">
    <xsl:call-template name="countChar">
    <xsl:with-param name="str" select="substring-after($str, ';')" />
    <xsl:with-param name="count" select="number($count) + 1" />
    </xsl:call-template>
    </xsl:when>
    <xsl:otherwise>
    <xsl:value-of select="$count" />
    </xsl:otherwise>
    </xsl:choose>
    </xsl:template>
    Done and then you will see the count in the td cell.
    I test with Title column and cut off string with ";" character.
    Thanks & Regards,
    Emir Liu
    TechNet Subscriber Support in forum
    If you have any feedback on our support, please contact [email protected] 
    Emir Liu
    TechNet Community Support

  • SPGridView with filtering on Taxonomy Field Multivalue column( column with multiple values in single row)

    Hi
    I have SPGridView  control (fetching value from DB) with a column which is having multiple values
    in single row seperated by ";", whenever filter applied it show these values in single row but i want
    to dispaly these values separately in diff. rows when column filter is applied.
    I have exactly same req. as mentioned in http://sadomovalex.blogspot.in/2011/03/spgridview-with-filtering-by-multiple.html
    but this solution didn't work for me.
    Please help/suggest.

    Hi Erland,
    Thank you very much for the answer. Sorry I had to be more accurate on my XML : This XML is in a SQL Server Table column. This table also has an id column. It will be great if you can answer specifically to this.
    <RootNode>
    <Node1>
    <Line_id_Node>1 </Line_id_Node>
    <A>
    <B>
    <D>Val1 </D>
    </B>
    <B>
    <D>Val2 </D>
    </B>
    <B>
    <D>Val3 </D>
    </B>
    </A>
    </Node1>
    <Node1>
    <Line_id_Node> 2 </Line_id_Node>
    <A>
    <B>
    <D>Val4 </D>
    </B>
    <B>
    <D>Val2 </D>
    </B>
    </A>
    </Node1>
    <Node1>
    <Line_id_Node> 3 </Line_id_Node>
    <A>
    <B>
    <D>Val5 </D>
    </B>
    </A>
    </Node1>
    </RootNode>
    Expected O/P:
    Line_id_Node                Column_D
    1                                                                    1                                           
    val1, val2, val3
    2                                                                    2                                               
    val4, val2
    3                                                                    3                                                  
    val5
    Nichesl

  • Can you add People Picker with multiple values to Word Document using Quick Parts?

    Hi all, I've been trying to develop a form in Word that takes a bunch of metadata from the SharePoint library. Most of it works okay, but when I try to add any fields that have been set up to take multiple entries in a people picker, they don't show up
    in the add quick parts list. Any ideas, or is this a limitation?

    Hi NREL,
    According to your description, my understanding is that the people picker column with multiple values was missing in Word Quick Parts.
    This is by design that we are unable to use the fields which is allowed multiple selections.
    As a workaround, you can use a text field(Single line of text) to store the multiple values of the people column. When you create a document, start a workflow to update the text field using the values of the people column, then use the
     text field in Word Quick Parts.
    You can do as the followings:
    Open your library, and create a new column using Single line of text.
    Open your site with SharePoint 2010 Designer, create a workflow based on your library.
    Add the action “Set Field in CurrenItem”, and set it like the screenshot.
    Set the Start Options is “Start workflow automatically when an item is created”.
    Best Regards,
    Wendy
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Wendy Li
    TechNet Community Support

  • Displaying Document Name With The Summary in a Single Column Using Document Library View.

    Hi All,
    I have a question that relates to SharePoint Document Library Views. I want to view the Documents name with the summary in a single column. Below image shows an example of it. I need this within a SharePoint Document Library. Also I want the height of the
    row to be increased more than the default height. I cannot figure it out how to do that? Could you someone help me to do this. I have inserted the Document Library as an App Part to the page. 
    So could you someone help me to solve this matter?
    Thanks and regards,
    Chiranthaka

    HI Chiranthaka,
    You can create DataView webpart using SPD and then modify the display template according to your need.
    http://deannaschneider.wordpress.com/2012/07/10/item-counts-dvwp-sp2010/
    Hope this will help to solve your problem.
    Best Regards,
    Brij K

  • Displaying Document Name & The Summary in a Single Column Using Document Library View

    Hi All,
    I have a question that relates to SharePoint Document Library Views. I want to view the Documents name with the summary in a single column. Below image shows an example of it. I need this within a SharePoint Document Library. Also I want the height of the row
    to be increased more than the default height. I cannot figure it out how to do that? Could you someone help me to do this. I have inserted the Document Library as an App Part to the page. 
    So could you someone help me to solve this matter?
    Thanks and regards,
    Chiranthaka

    HI Chiranthaka,
    You can create DataView webpart using SPD and then modify the display template according to your need.
    http://deannaschneider.wordpress.com/2012/07/10/item-counts-dvwp-sp2010/
    Hope this will help to solve your problem.
    Best Regards,
    Brij K

  • Sharepoint 2013 Document library view show version history

    Hello everyone,
    I have a document library view with many folders. Each folder is a procedure and have document attached to it.
    When I add a new version, I would like to show version history for each document contained in the folder. For example:
    There is a folder Procedure 123 which has three files ( File1, File2, and File3). After a week the user the user created new revisions for each document.
    I would like to have a document view with the following information
    File Name   version
    ======  ======
    File 01         0
    File 02         0
    File 03         0
    File 01         1
    File 02         1
    File 03         1
    File 01         2
    File 02         2
    File 03         2
    Thanks for your help.
    Jhonny Marcelo

    This is quite simple, you have to modify the current view (Modify this view) of document library and then you can select version column from available column list (make sure version is enabled). please check below picture for detail.
    Adnan Amin MCT, SharePoint Architect | If you find this post useful kindly please mark it as an answer.

  • Set the horizontal scroll bar for the OOTb document library view

    hi all,
     Am facing an issue in my sp portal.We have designed and developed the portal with OOTB document library views for site columns also. Going to enable the doc lib view. but  we have some  35 columns in eeacha nd every document
    library within our sub site. But if an end user wants to see the last column then he needs to scroll. but, since  then my master page has fixed width, the top corner will be seen as blank. would like to know how can we set horizontal scrolling
    in this doc lib view .
    Das

    Hi,
    According to your description, my understanding is that you want to set the horizontal scroll bar for the document library when the last column postion exceed the fixed width.
    I suggest you can try to use Jquery to set the width attribute of the menu bar dynamically if the document library width exceeded. You can add the Jquery or CSS style using SharePoint Designer under the PlaceHolderMain tag of document
    library page. Also, you need to find the div id in your environment using Internet Explorer.
    More information:
    http://sharepointpromag.com/sharepoint-development/sharepoint-branding-101-branding-master-pages
    Thanks
    Best Regards
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Show custom EditForm from a specific document library view

    Hello,
    I've created a custom EditForm that I would like to show when the user clicks the "<label for="ShouldDisplayEdit">Edit" (link to edit item)</label> icon; however I just want to show this EditForm for a specific view.
    I have a listview webpart (actually an "app") for the library and this specific view set on a page. However, it opens the default edit form instead of the custom one. (StatusEdit.aspx). I don't want to set StatusEdit.aspx as the default, as it
    has fewer fields than the default edit form.
    I am able to hide fields conditionally using SPClientTemplates.TemplateManager.RegisterTemplateOverrides, but it's been a lot of work to try to make it match the requirements I have. I'd really like to have the custom edit form work if it's possible.
    Thank you for your help!
    Best Regards,
    Kevin Worthington

    Hi,
    According to your description, my understanding is that you want to specify the custom EditForm for a specific document library view.
    We can change the link to edit item button url using Jquery to achieve it.
    Here is a code snippet for your reference:
    <script src="http://code.jquery.com/jquery-1.10.2.min.js" type="text/javascript"></script>
    <script type="text/javascript">
    function changeurl()
    $(' ms-itmHoverEnabled ms-itmhover ms-droppable).find('ms-vb-lastCell ms-cellstyle ms-vb-icon ms-vb-lastCell').attr(‘href’,”http://new url”);
    </script>
    Here are some detailed articles for your reference:
    http://stackoverflow.com/questions/179713/how-to-change-the-href-for-a-hyperlink-using-jquery
    http://stackoverflow.com/questions/8729830/jquery-find-td-of-tr-with-class-and-make-changes-for-a-telerik-mvc-grid
    Thanks
    Best Regards
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Jerry Guo
    TechNet Community Support

  • Document Library view selection menu missing

    Hi,
    I am encountering a strange issue with the SP2013 document library web part. I included a screenshot (see link) where you can see that the web part of the doc lib doesn't contain a view selector menu at the right side. This is only available after
    you go to the document library system page by clicking on the title of the document library. Does anyone have experience with this issue? Its very frustrating because the customer wants to see all the views at the home page of the site.  Thanks for the
    help.
    http://1drv.ms/1k5rSjk
    Blog: www.jasperoosterveld.com Twitter: @SharePTJasper

    You can still get to those views using the ellipses next to the view name can't you?
    It's probably related to the way that SharePont handles multiple web parts on a page. Rather than handle item references for multiple web parts they've been stripped out.

  • Set Document library view as welcome page

    Hi
    I want to set my Document library view as welcome page of my SharePoint  site 2013.
    How can I achieve this.
    Regards,
    Siva.

    Hi,
    According to your description, my understanding is that you want to change the welcome page to the document library view page in SharePoint 2013 site.
    You can use SharePoint designer to find the view page in “All files” and then set the document library view page as welcome page .
    Here is a detailed article for your reference:
    http://techtrainingnotes.blogspot.com/2011/06/sharepoint-how-to-change-default-home.html            
    Thanks
    Best Regards
    Jerry Guo
    TechNet Community Support

  • Sql query slowness due to rank and columns with null values:

        
    Sql query slowness due to rank and columns with null values:
    I have the following table in database with around 10 millions records:
    Declaration:
    create table PropertyOwners (
    [Key] int not null primary key,
    PropertyKey int not null,    
    BoughtDate DateTime,    
    OwnerKey int null,    
    GroupKey int null   
    go
    [Key] is primary key and combination of PropertyKey, BoughtDate, OwnerKey and GroupKey is unique.
    With the following index:
    CREATE NONCLUSTERED INDEX [IX_PropertyOwners] ON [dbo].[PropertyOwners]    
    [PropertyKey] ASC,   
    [BoughtDate] DESC,   
    [OwnerKey] DESC,   
    [GroupKey] DESC   
    go
    Description of the case:
    For single BoughtDate one property can belong to multiple owners or single group, for single record there can either be OwnerKey or GroupKey but not both so one of them will be null for each record. I am trying to retrieve the data from the table using
    following query for the OwnerKey. If there are same property rows for owners and group at the same time than the rows having OwnerKey with be preferred, that is why I am using "OwnerKey desc" in Rank function.
    declare @ownerKey int = 40000   
    select PropertyKey, BoughtDate, OwnerKey, GroupKey   
    from (    
    select PropertyKey, BoughtDate, OwnerKey, GroupKey,       
    RANK() over (partition by PropertyKey order by BoughtDate desc, OwnerKey desc, GroupKey desc) as [Rank]   
    from PropertyOwners   
    ) as result   
    where result.[Rank]=1 and result.[OwnerKey]=@ownerKey
    It is taking 2-3 seconds to get the records which is too slow, similar time it is taking as I try to get the records using the GroupKey. But when I tried to get the records for the PropertyKey with the same query, it is executing in 10 milliseconds.
    May be the slowness is due to as OwnerKey/GroupKey in the table  can be null and sql server in unable to index it. I have also tried to use the Indexed view to pre ranked them but I can't use it in my query as Rank function is not supported in indexed
    view.
    Please note this table is updated once a day and using Sql Server 2008 R2. Any help will be greatly appreciated.

    create table #result (PropertyKey int not null, BoughtDate datetime, OwnerKey int null, GroupKey int null, [Rank] int not null)Create index idx ON #result(OwnerKey ,rnk)
    insert into #result(PropertyKey, BoughtDate, OwnerKey, GroupKey, [Rank])
    select PropertyKey, BoughtDate, OwnerKey, GroupKey,
    RANK() over (partition by PropertyKey order by BoughtDate desc, OwnerKey desc, GroupKey desc) as [Rank]
    from PropertyOwners
    go
    declare @ownerKey int = 1
    select PropertyKey, BoughtDate, OwnerKey, GroupKey
    from #result as result
    where result.[Rank]=1
    and result.[OwnerKey]=@ownerKey
    go
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Update column with ROW_NUMBER() value

    I have a column that I would like to update with a ROW_NUMBER() value partitioned by a specific column.
    CREATE TABLE ##tmp (id INT NULL,
    value1 VARCHAR(10),
    value2 VARCHAR(10))
    INSERT INTO ##tmp (value1,
    value2)
    VALUES ('A', 'asdfasdf'),
    ('A', 'asdf'),
    ('A', 'VC'),
    ('B', 'aasdf'),
    ('C', 'sdfgs'),
    ('C', 'xdfbhsdty'),
    ('C', '23sdgfg'),
    ('C', '234')
    -- update the ID column with the values below
    SELECT ROW_NUMBER() OVER (PARTITION BY Value1 ORDER BY Value2),
    Value1,
    Value2
    FROM ##tmp
    I have 14 million records.  Can someone explain the best way to do this?  Does the ORDER BY destroy performance for this many records?
    Thanks!

    CREATE TABLE ##tmp (id INT NULL,
    value1 VARCHAR(10),
    value2 VARCHAR(10))
    INSERT INTO ##tmp (value1,
    value2)
    VALUES ('A', 'asdfasdf'),
    ('A', 'asdf'),
    ('A', 'VC'),
    ('B', 'aasdf'),
    ('C', 'sdfgs'),
    ('C', 'xdfbhsdty'),
    ('C', '23sdgfg'),
    ('C', '234')
    -- update the ID column with the values below
    ; with cte as (
    SELECT ROW_NUMBER() OVER (PARTITION BY Value1 ORDER BY Value2) as RowNumber,
    Value1,
    Value2
    FROM ##tmp
    update cte
    set Id = RowNumber;
    Russel Loski, MCT, MCSE Data Platform/Business Intelligence. Twitter: @sqlmovers; blog: www.sqlmovers.com

  • OLAP on 11g and Materialised Views with Multiple Value-Based Hierarchies

    Hello OLAPians
    I am trying to setup Orable BIEE to report on an OLAP cube with pre-aggregated data. As OBIEE is not able to hook into the OLAP directly i have to create an SQL cubeview.
    Currently i am on a 10g OLAP environment and am using the oracle sample SQL cubeview generator to create an SQLview of my cube.
    The cube itself has multiple dimensions and these dimensions have multiple VALUE-based (ragged) hierarchies and dimension members can be shared across hierarchies also.
    Initially i had a problem running the view generator plugin because there is a bug within it that does not finish if there are multiple value-based hierarchies present. I was able to get around this by manually editing the limitmap for the cubeview and manually creating the SQL view.
    The question that i want to ask is how robust is the 11g materialised views with multiple value-based hierarchies and the sharing of dimension members across different hierarchies?
    Has anyone successfully been able to create a cubeview and import it into OBIEE without the hassle of manually editing the limitmap?
    A problem arises with the value-based setup whereby if the client creates a newer depth in the ragged hierarchy, i need to manually create the limitmap and the cube-view over again, and then re-map the BI Administration mappings.

    The simple answer to your question,
    how robust is the 11g materialised views with multiple value-based hierarchies...?is that materialized views are not supported on top of value-based hierarchies in 11g. The reason is that it is not possible to write a reasonable SQL statement that aggregates a fact over a value-based hierarchy. Such a SQL statement is necessary if we want to create a rewritable MV on top of the cube.
    But I suspect this is not what you are really asking. If you are trying to set up OBIEE on top of the cube in 10g using the view generator, then you will probably want to use the "ET VIEWS" that are generated automatically in 11g. These are generated whether or not you enable materialized views on top of your cube. I am not aware of any issues with the generated value-based hierarchy view support in 11g. Members may be shared between value hierarchies and you will not need to generate or modify limit maps.

  • When viewing the weather default app with multiple cities, how come there isn't a one click shortcut to go back to the first city?

    When viewing the weather default app with multiple cities, how come there isn't a one click shortcut to go back to the first city?

    3.2 you can make multiple clocks, each clock can have a different alarm.

Maybe you are looking for

  • Updated to 10.8.2 and now none of the MS Office 2011 are working

    Recently, I updated to 10.8.2 and now, none of my Microsoft Office products are launching (2008 or 2011). Any ideas what how this upgrade could have so adversely affect Office and what can be done to correct it?

  • Mail.app not connecting post 10.5.6 upgrade

    Since upgrading to 10.5.6 Mail no longer connects to any of my email accounts, including Exchange server and POP accounts (2). All I get is a timeout window. I have deleted Exchange account and tried to re-enter, but still unable to connect. There is

  • Error word web app can not open this document for viewing in office web apps 2010

    Hi  i am receiving office web apps error. i installed sharepoint 2010 on windows server 2012 datacenter, and installed office web apps 2010 and sp2 adil

  • Import of bulk serial numbers with Goods Receipt

    Hello I need to create an Add-On that automates the creation of Goods Receipt PO documents with linked serial numbers. Using the DI API I manage to create the Goods Receipt and link about 1000 serial numbers to one document without any problems. When

  • MDM tracking READY folder

    Hi all I am looking for some solution to monitor: - exceptions and - ready folders. The idea is to have automated process to infor us about errors. We also want to monitor READY folder to check if files are staying in that folder for long and from so