Create a wildcard, case insensitive filter

I’ve recently found the need to create a user friendly filter for a multiple value column, rather than the users having to enter a case sensitive query.  In the following example I used the dataview web part, though the trick is down to the XSLT filtering so its adaptable, here’s how:

  1. Add a text filter web part to the page containing your dataview web part
  2. Create a parameter within your dataview web part, setting the source to be none
  3. Connect the text filter to your dataview webpart, choosing Get Parameters from rather than get filter values from
  4. On the dataview web part, setup a filter as you usually would, however check the Add XSLT Fitlering box, then press the edit button
  5. Paste in the following code, replace @Companieso for the column you would like to filter, then replace $Companies with the parameter you created earlier.

contains(translate(@Companies0, 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'),translate($Companies, 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'))


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s