CGI_PortalPractice
asked on
SharePoint Group By List Multiple Value Field
Does anyone know of a way to have a custom field on a Document Library in SharePoint that accepts multiple inputs (like a Choice select box), but still be able to create a Group By list view on that value in SharePoint 2007 (MOSS).
ASKER
Was kind of hoping for a work around to the problem, not the generic you can't do it. We actually decided to build the web part manually since no one was able to provide a solution. We used the SPQuery object and a camel query. You can find an example of how to use the SPQuery on msdn. Here's kind of what we did to sort the information:
SPSite spsite = new SPSite("siteurl");
SPWeb site = spsite.OpenWeb();
SPList list = site.Lists["listname"];
SPQuery query = new SPQuery();
query.Query = "<Where><Eq><FieldRef Name='ServiceLevel'/><Valu e Type='String'>345</Value>< /Eq></Wher e>";
SPListItemCollection items = list.GetItems(query);
foreach (SPListItem item in items) //here its throwing exception.
{
Console.WriteLine(SPEncode .HtmlEncod e(item.Xml ) + "<BR>");
}
You can get a CAML statement builder called U2UCamlCreator.exe. Then you'd need to build a CAML statement that would select the field that is the choice column, and for the value you do a contains and then the value you want to do the select by.
We then built a web part that displays the information in sharepoint similiar to the way the regular datagrid does, except it lacks a lot of the additional functionality.
SPSite spsite = new SPSite("siteurl");
SPWeb site = spsite.OpenWeb();
SPList list = site.Lists["listname"];
SPQuery query = new SPQuery();
query.Query = "<Where><Eq><FieldRef Name='ServiceLevel'/><Valu
SPListItemCollection items = list.GetItems(query);
foreach (SPListItem item in items) //here its throwing exception.
{
Console.WriteLine(SPEncode
}
You can get a CAML statement builder called U2UCamlCreator.exe. Then you'd need to build a CAML statement that would select the field that is the choice column, and for the value you do a contains and then the value you want to do the select by.
We then built a web part that displays the information in sharepoint similiar to the way the regular datagrid does, except it lacks a lot of the additional functionality.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You could not use multiple values column and grouped by each of them. Think in database view of point. I had this request before and the answer was no. If you want to group by a certain value, you have to single them out.
Thanks.