Multi-Value Filtering on SharePoint Lists

Published Wednesday, April 21, 2004 12:27 PM

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.

Filed under:

Comments

# Ian Morrish said on Thursday, April 22, 2004 3:17 AM

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

# Westin said on Thursday, April 22, 2004 8:41 AM

That amazes you? Seems like you knew that on the second: http://www.wssdemo.com/blog/DispLog.aspx?XPage=58b5f5d8-21cc-49b1-af2e-26cf89e44bc3:SetFilter:FilterField1%3d%252540ID%26FilterValue1%3d19 :)

# Bernie Quick said on Wednesday, May 05, 2004 5:34 PM

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?

# Westin said on Thursday, May 06, 2004 10:39 AM

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.

# Uri Nissani - KWizCom said on Sunday, May 27, 2007 1:24 PM

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

# Albert (arzo2000@hotmail.com) said on Tuesday, July 17, 2007 10:36 AM

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

# Satheesh said on Thursday, August 23, 2007 10:01 AM

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

# Steve Walsh said on Thursday, September 18, 2008 1:51 PM

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

# cristina said on Thursday, October 23, 2008 6:40 PM

how can choose two items from the same column?

such as

...?FilterField1=Metric&FilterValue1=Time&filtervalue2=days  ( i mean ...hypothetically)  

# Anjali said on Tuesday, May 12, 2009 5:36 AM

Check this link for Multi value filtering & use of keywords like contans, begin with; which replaces the use of wild card characters:

philwicklund.com/.../using-the-data-view-web-part-to-search-a-sharepoint-list.aspx

# Steve said on Thursday, July 02, 2009 2:06 PM

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?

# Pallavi said on Wednesday, September 09, 2009 12:56 PM

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…

# Andrea said on Tuesday, September 22, 2009 1:29 PM

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.

# Liam said on Tuesday, December 15, 2009 5:33 PM

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

# Matthew Dustan said on Sunday, December 20, 2009 12:37 PM

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.

# Feb2011 Sharepoint 2007 Links Vol 2 « BD's Weblog said on Monday, February 21, 2011 11:22 PM

Pingback from  Feb2011 Sharepoint 2007 Links Vol 2 « BD's Weblog

# Sharepoint filter | Aunoma said on Sunday, February 12, 2012 8:32 AM

Pingback from  Sharepoint filter | Aunoma

Leave a Comment

(required) 
(required) 
(optional)
(required)