Multi-Value Filtering on SharePoint Lists

James writes:

“I happen to come across your blog site and found it very interesting.  I've been researching on how to customize the Form Web Part on a team site in Sharepoint 2003.

For example, I'm wanting to customize the form web part to have two inputs.  One would be for 'First Name' and the other for 'Last Name'.  The form web part will be connected to a custom list and will filter the list based on both first AND last name.  I have been able to accomplish filtering a list with one input value but not multiple.

When I use Front Page 2003 I create the connection but it only gives me the option to select one column name from the form web part and match it with one column in the custom list.  I've done research on the form web part and found that you can filter a custom list with multiple input fields but I cannot find out how.  ...”

One way to accomplish filtering SharePoint lists using multi-value filters is to take advantage of the URL Protocol for SharePoint lists.

In this case, you would specify FilterField1=FirstName and FilterField2=LastName if those where the respective names of the columns you wish to filter.  For example:

http://[server]/[site]/Lists/Contacts/AllItems.aspx?FilterField1=LinkTitleNoMenu&FilterValue1=Doe&FilterField2=FirstName&FilterValue2=John

The preceding example would filter a list based on the built in Contacts list template.  Using this you can use a simple HTML form to perform a post using hidden form fields for the FilterField1 and FilterField2 values, and use text boxes for FilterValue1 and FilterValue2 fields.  This does not use the Form Web Part, but it accomplishes multi-value filtering.  The only way I've seen the Form Web Part provide multiple values is if the web part supports consuming them, which the Data View and List Web Parts do not.  This Terraserver web part is an example of one that does.

13 Comments

  • Amazing, someone found one of my demo's somewhat interesting ;-)

  • Okay - so you demonstrate how to "send" multiple parameters to a web part - but how do I consume multiple parameters? Also, can this be done via Frontpage Web Part Connections?

  • Bernie, the URL protocol is specific to SharePoint lists. You aren't really sending parameters to a web part using the URL parameter, in so much as the List View web parts that show up on the "All Items" list views are not normal web parts. With regard to consuming multiple parameters this is up to the web part. The web part must be either an iRowConsumer, iFilterConsumer, or iParametersInConsumer in order to deal with a row of values. If the pairing of web part connections is supported you can pair them in FrontPage and in some cases through the browser.

  • Hi,
    we created a solution just for this issue -

    SharePoint Multiple Drop-Down Filter Web Part
    Overview
    SharePoint Multiple Drop-Down Filter Web Part connects to any standard SharePoint list and allows you to filter the list's items by more than one field

    please tell us what you think!
    Thanks
    Uri



    Key Features

    Supports MOSS 2007 / WSS 3.0
    Apply multiple filters to a single SharePoint list
    Fully customizable interface via CSS
    Customizable captions
    Multi-lingual



  • I was wondering if there was a way to apply a similar filtering method like this on a Sharepoing calendar. Any ideas?

  • Is there anyway to use wildcard search using this multi-value filtering

  • Is there anyway to do an OR... so it is FilterField1 OR FilterField2 ??? I am drove nuts tryign to find this...

  • how can choose two items from the same column?
    such as
    ...?FilterField1=Metric&FilterValue1=Time&filtervalue2=days ( i mean ...hypothetically)

  • Is there a way to create a url that filters a 'person or group' field based on that field containing the user that is logged in?

  • Hi,
    I liked your post – I have a problem of filtering based on the custom metadata lookup field.. The lookup field is saved as ; separated.
    List A has the meta data of lookup column field with multiple values.
    I need to display the items in a dataview where the filter is only a.Fetch only articles with metadata of a i.e. A4 should not be returned
    A1 > a;b;c;d;ab;bc;cd
    A2 > a
    A3 > a;b;ab
    A4 > ab;bc
    i will greatly appreciate if someone has a solution for this…

  • I'm trying to follow your instructions, but I don't really understand code and I'm not sure what URL protocol is (link is broken).

    I'd really appreciate detailed instructions for dummies!

    Thanks.

  • Is there anyway to filter using a greater than operator? The example you provide only returns exact matches to the FilterValue. I need to return all results that are greater than the FilterValue

  • I have been trying to get the URL filtering to work for me.

    My problem is slightly more complex

    I have four columns that can be filtered. Each column has multiple values.

    But the user may not wish to filter all 4 columns 1 2 or 3 may suffice in any combination.

    How do i get around the fact that each filter does not carry a set filter number i.e. 1 to 4 this number instead will change depending on the order the filters are selected and how many are selected.

    In essence i need

    FilterFieldW
    FilterFieldX
    FilterFieldY
    FilterFieldZ

    where w x y and z are a number 1 to 4 dependant on the existing URL which may already contain filters.

    hope my explanation is clear this is annoying me that I cant figure out the coding.


Comments have been disabled for this content.