The Text Filter Web Part – Without Having To Filter Exact Text

This applies to both SharePoint 2007 and 2010.  In MOSS Enterprise, and the 2010 version of Enterprise.

UPDATE (3/14/16): If you are using SharePoint 2013 or SharePoint Online with Office 365, enterprise, you don’t need this solution.  This functionality is now built into every single list and library, with a cute little “Find” box at the top.

There is an out-of-box web part called the Text Filter Web Part.  Basically, when you put this web part on a page, and put a list or library web part on the same page, you then create a web part connection that sends the text typed in the box as a filter to one of the columns in the web part, like this:

ch5[38]

The name Molly Clark had to be typed in exactly.  So, if you typed “Molly”, this record would not come up.

People use the text filter web part when they just want to search a single column in a list or library.  Otherwise, you’d simply use the “Search” box at the top of the screen, choose “This List” or “This Site” and perform SharePoint searches that way.

One more note before I get into today’s solution:

If you’re making use of site columns in your lists, there’s a setting where you can specifically select which columns you do NOT want to be searchable on the site.  In Site Settings, click Searchable Columns.  Put check boxes in the NoCrawl column for the ones that shouldn’t be searchable.
ch5[40]

Here’s how to set up the text filter so that any partial word searches will work

One problem:  with this solution, I don’t think there’s a way to make the list automatically display all items by default before doing your filter.

So again, this involves a data view web part… and that “parameters” concept that I keep raving about.

  1. Go to a web part page, open it up in SharePoint Designer, and insert a text filter web part and a data view web part of any list or library.
  2. Click to select your list web part, click the Data View menu, and choose Parameters.
  3. Create a new parameter.  In the name column, it doesn’t matter what it’s called, let’s just call it FilterParam.  In the Parameter Source drop-down box, choose Query String.
    The Query String Variable needs to be the exact name of the column that you’d like to filter.
    image
  4. Click the Data View menu, and choose Filter.
    image
    The Field Name needs to be the name of the column you’re going to filter, and HERE’S THE TRICK: Form the Comparison, choose CONTAINS.  For the Value, choose the name of the parameter that you created at step 3.  Click OK.
  5. Right click on the Text Filter Web Part, and choose Web Part Properties.
  6. The Filter Name box is required.  Make something up.  If it’s going to be used to search the title field, you might want to call it something intuitive like “Search Title”.  There’s also a box in the Advanced Filter Options, to control the width in pixels.  Type in a width if you wouldn’t like the web part stretching across the entire page.  Click OK.
  7. Right click on the text filter web part, and choose Web Part Connections.
  8. Choose Send Filter Values to.  Click Next.
  9. Connect to a web part on this page.  Click Next.
  10. Target web part: choose the name of your list.  This part is important:  The target action needs to be Get Parameters From.  Click Next.
    image
  11. Click the name of the text filter on the left, and the name of your new parameter on the right.  Click Next.
    image
  12. Click Finish and save the web part page.

Try it out.  In the text filter, you can type any part of any word and hit enter.  It doesn’t take Boolean expressions or anything fancy like that, but it’s much more useful than having to type the text exactly.  Again, this is a solution that I just whipped up today, and can’t tell if there’s any way to make the web part show all items until you want to filter it.  Nothing obvious.  I guess if you need to have the whole list displayed, you can just insert a third web part on the page, as a full view of the list.

 

112 comments

  • Laura
    How would you do this with a choice filter with “allow multiple selections” checked?
    Essentially how do we create an OR query string

  • Galliano,
    There isn’t a way to do any of that with this simple web part.

  • Hi Laura. In Sharepoint 2013 is it possible to limit the cute little find box to only search the title field. Thanks.

  • Hi Laura,

    I can’t seem to be able to activate this “find” box in my lists within sharepoint online. Where would I be able to set this up? the list, view or webpart settings?

    Thanks

  • Hi all!
    Many Thanks to Laura for this solution, I used it so many times!

    There is a solution to show all items at the start and I want to share it with you!
    In my Scenario, I want to search for a plain text field. To show all items, you have to set up 2 things additive:

    1. Create a calculated column with the text field you want to search and then add a Wildcard. I use *
    The forumula should look like this: =[Textfield] & ” *”

    2. Point the parameter in step 3 to this new column and type the Wildcard(*) in the ‘Default Value’ box.

    Thats all of the magic. Have fun!
    Greetings from Germany
    Florian

  • Laura,
    I have the Find an Item box enabled on my list, however, it does not work with a partial. For example, it’s a list of contacts and I want the customer to be able to type in alb and show all last names that start with alb….. How do I do this?

  • Laura, I’ve added a document library to a page as a web part. As an Admin, Searching provides results for me using ‘Find a file'(cute little find box at the top). I’ve had users with Read access try though, and they do not receive anything. It only spins. I’ve googled this and haven’t found a solution. I’ve tried creating a new library without spaces in the name, as someone had indicated, but it doesn’t fix the issue. What’s the trick to keep this functionality when added as a web part to a page? Your help is greatly appreciated!

  • Great article! Works like a magic. Thank you for sharing this trick. It resolved our issue with search!

Leave a Reply