Data View Web Part & Multiple Filters

In two previous posts I detailed a method of using partial text in a search filter on a data view web part. You can find the posts here:
Part 1
Part 2
Multiple Searches
Up until now I have always created one page per search, but some of my users started to complain that this meant more time was taken up keep changing pages so I started to look into how to create multiple searches on the same page.
So my page has a data view web part and a three text searches added.

A . Richards 1

Parameters
The next step is to add the parameters that I will use to filter the list
To do this highlight the data view web part and select Parameters from the ribbon

A . Richards 2

The image below shows the 3 parameters I have added, in each case the source is a query string and the variable should match exactly the title of the column you will be searching on

A . Richards 3

Filters
I now need to add the filters to the data view web part
To do this highlight the data view web part and from the ribbon select Filter

A . Richards 4

The filtering uses a series of And/Or options to filter the data that is presented in the data view web part
The image below shows the criteria that will be used to filter the data view

A . Richards 5

Using the Or option means that the filter will look for any one of the first 3 criteria AND the final criteria, so for example it could filter the data on Year AND ARCode or any one of the 3 combinations

Filter Connections
I now need to connect the text filters to the data view web part
To do this right click the first text filter and click Add Connection

A . Richards 6

Select Send Filter Values To and click Next

A . Richards 7

Leave the default selected and click Next

A . Richards 8

On this screen select the data view web part you want to connect to, set the target action to Get Parameters From and click Next

A . Richards 9

On this screen you need to match the text filter to the Parameters you set earlier in the process. If you title your text filters to match what they are going to filter on it makes it a lot easier

Now click on Next & Finish

So that’s the text filter setup, you only need to repeat the process for each text filter on the page changing the setting for the last screen

Final Results
If we now navigate to the page we can test out the filters
Lets start with a surname that is in the data

A . Richards 10

As you can see it brings up data of a user with Smith in their name
So what about the other searches

A . Richards 11

So that’s the tutor group search working as well
And finally the year search

A . Richards 12

Alan Richards has been working in Schools for 17 years and during that time has been at the forefront of using IT. As well as managing his own school’s SharePoint implementation he also manages the SharePoint farm for the local consortium of schools. Alan is also a regular blogger and speaker at various events.

Check out our new resource centre  for more insightful work from Alan .

Stay tuned for more SharePoint content by  joining our community or by following us on  twitter or facebook.

Share this on...

Rate this Post:

Share: