I have what I thought a simple problem, but can't seem to find any solutions that work or exist in SharePoint 2013.

I have a multiple selection list box in an InfoPath 2010 form. This box defines the category the document belongs to. There are 8 options and users can select as many as they like. When viewing the list users should be able to filter by category (using the standard method of filtering of columns). I can link the column to SharePoint with the merge data type, and this shows all of the values in the column but SharePoint does not allow filtering of this type of column:

Standard Column Can't be filtered

I have a field in my InfoPath form that’s hidden and concats the values in the multiple selection list box into a comma separated string. This is filterable as a column but as the values are saved as comma separated strings multiple selections are treated as a unique entry. I want the filter to look at this field and be able to select one of the 8 categories and display any item that contains this value, not just items that exclusively contain this value.

enter image description here

My concatinated string can be filtered, but multiple selections show as a new value.

For example if I have the following 4 items:

**Document**     **Category** 

Item1             1
Item2             1, 2
Item3             2
Item4             3, 8, 5

And I filter by category 1, I want it to display Item1 and Item2.

If I filter by category 1 and 2, I want to display Item1, Item2 and Item3

3 Answers 3


I ran into this before and came up with a solution that is not as clean as one would have hoped, but it worked for me, granted that it's a dirty trick/workaround and it's far from being perfect.

I tested it in SharePoint 2010, but from what I can see from your description, nothing has changed in SharePoint 2013 (read: dealing with multiselection box in InfoPath and SharePoint is a real pita).


  • a QueryString parameter declared on the XsltListViewWebPart
  • a filter on the XsltListViewWebPart
  • a CEWP webpart on the view page
  • an external file (stored for example in SiteAssets) with a bit of javascript and linked to the CEWP webpart
  • jquery
  • underscore.js


Open the page containing the XsltLVWP in SharePoint Designer and add a QueryString parameter, call it eg. Category. Then, create a filter with this criterion: Category Contains [Category] where [Category] is the parameter you've just declared.

Add a file to the SiteAssets library, call it eg. getCategories.js. The content should look more or less like this:

<script type="text/javascript">
function retrieveListItems() {
var clientContext = new SP.ClientContext();
var list = clientContext.get_web().get_lists().getByTitle('YourList');
var camlQuery = new SP.CamlQuery();

// retrieve only the category field
camlQuery.set_viewXml('<View><ViewFields><FieldRef Name="Category"/></ViewFields></View>');
this.listItems = list.getItems(camlQuery);

clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed)); 

function onQuerySucceeded(sender, args) {
    var listItemEnumerator = listItems.getEnumerator();

    var allCategories = [];    
    var i;

    while (listItemEnumerator.moveNext()) {
        var listItem = listItemEnumerator.get_current();
        var category = listItem.get_item('Category');

        //we need to split the comma separated string
        if (category.indexOf(',') !== -1){
            var tempCategories = category.split(',');
            for (i = 0; i < tempCategories.length; i++){
                allCategories[allCategories.length] = tempCategories[i].trim(); //remove initial white space
            allCategories[allCategories.length] = category;

    // we need unique categories
    allCategories = _.uniq(allCategories); //underscore.js uniq method

    // add all unique categories to the dropdown
    for (i = 0; i < allCategories.length; i++){
        var option = $('<option>');

    $('#categoriesDdl').on('change', function(){
        window.location.href = "/yuorsite/list/page.aspx?" +  "Category=" + $('#categoriesDdl').val();

function onQueryFailed(sender, args) { 

ExecuteOrDelayUntilScriptLoaded(retrieveListItems, 'sp.js')


<!-- this is our custom filter -->
<select id="categoriesDdl">
   <option>---select a category</option>

The code creates a dropdown list with all the unique categories extracted from the category field and append the selected value to a querystring parameter, thus triggering the filter on the XsltLVWB.

Add a CEWP to your view page and link the getCategories.js file.

Known issues:

  • having set a parameter and a filter, the first time the page is rendered, nothing is shown
  • if your categories have overlapping names, then the contains filter will produce unwanted results (eg. category 1 and category 10 will both be shown when your filter is = 1)

Other solutions:

considering that you're on SharePoint 2013, I would go the REST way and build my own datagrid with full custom filters (for the category filter dropdown the logic would be more or less the same). Here you can find some inspiration.

  • Thats great ! I guess it doesnt work for Managed Metadata Column Type ?
    – Jeff
    Commented Aug 30, 2018 at 13:54

A workaround without developing is to activate the key filters (metadata navigation. You will need to activate the site collection feature : publishing, the site feature : publishing and navigate to the library settings and configure which fields shall be multi-filterable

enter link description here


In the filter settings, use the expression:

contains(eval(field1,',,'), 'my category')

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.