All right stop! Collaborate and listen (Sharing Points)

October 9, 2006

Filter values for a Data View webpart

Filed under: Sharepoint — stephenmuller @ 3:35 am

I have been trying to add a little more flexibility to an existing sharepoint site. Currently some webparts look at the querystring  to determine what documents should be displayed to the user. IE if the querystring has http://blahurl?Doc=Policy then the document relating to policy would be displayed.

Works well, however I wanted to be able to list documents that may have been marked as ‘Policy – Email’ or “Policy – Leave’ etc.

 When using the default way of editing these webparts via frontpage. I selected the Filter link for the webpart I wish to edit, the only options that are available for comparing the field with the query string, were only the numeric comparisons were available in the dropdown (Equals, Is Null, Less than etc). I was after the “Contains” comparison.

I went back to the webpart in frontpage and selected web part properties and edited the Data Query Editor xml fragment. The section to change is

 <dsp:where xmlns:dsp=”Http://micorsoft…….”>

<dsp:Eq>

<dsp:FieldRef Name”Yourfield”/>

<dsp:Value Type=”xsd:string”><udc………..>

</dsp:Eq>

</dsp:where>

Change the <dsp:Eq> to <dsp:Contains> and the closing tag as well. There is another string comparison that can be used but the link where I got the info from is

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/spptsdk/html/soapmqueryRequest_SV01071735.asp

It all worked well and was even reflected in the filter string visible in Frontpage.

Hope this helps someone.

Advertisements

1 Comment »

  1. I’m tyring to do something similar. However I want to dynamically change the filter value based on another value on the page

    I’ve added a List webpart to DispForm.aspx, but I want the filter value to be equal to the

    Something like this:

    Of course, this code won’t work, but what will?

    Hank

    Comment by Hank — April 4, 2007 @ 9:27 pm


RSS feed for comments on this post. TrackBack URI

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: