1. What you need on a page:
a. 2 Date Filter webparts
b. 1 list to be filtered
2. Open the page w/ SPD, convert the list to be filtered to DataView (Convert to DataView will give you a lot more columns to choose in the DataView’s Filter critiera, as oppose to going to Insert->Sharepoint Controls->DataView. However, you will still not see a ‘[StartDate]’ and ‘[EndDate]’ when you go to Filter on the DataView's 'Common Date View Tasks'.
3. Now it's time to create the 'StartDate' and 'EndDate' parameters:
Under the DataView's 'Common Date View Tasks', choose Filter, click on the 'Click here to add a phase', scroll down and click on 'Create a new parameter'


4. Now we are ready to configure the filter for the Date View:

5. In the code view, you should see the newly added parameters:
<ParameterBinding Name="StartDate" Location="QueryString(StartDate)" DefaultValue=""/>
<ParameterBinding Name="EndDate" Location="QueryString(EndDate)" DefaultValue=""/>
6. Now we need to setup the connections from the DataView so it knows where to get the data for the parameters. Click on the little arrow for ‘Common Dataview tasks’, go to webpart connections (Note: makes sure you choose the ‘Get Parameters From’)

When done going through the Web part Connections Wizard, you should see something like this:

7. Almost done. Now go to the browser and edit page. Click on the date filters to connect the webparts. The Data needs to know where to get the filter values. Even though the connections were setup from the DataView, you still have to setup the filter fields from the Date Filters. Note the consumer field name is the parameter we setup earlier. Do the same for each date filter, one for the 'StartDate' parameter, one for the 'EndDate' parameter.

8. Done. Final result could be something like this:
22 comments:
This is a great guide, however i am struggling with it.
Once I get the date filter working, any alterations to the page seem to break the web part connections and i get no results in the data view web part.
I must have created my page a dozen times and there's always something i miss and even number formatting in the DVWP breaks it !
Pete
@Skibutt - I am having the same issue, not sure what is happening but even applying CSS to the date web part the list just goes away... I noticed if I complete all formatting to the page as well as all of the items that need to be tweaked before completing step #7, all is good to go.
This means I do everything I need to do to the page after step #6 and then perform step #7 absolutely last and all works fine.
mhh, well at least i'm not the only one. My advice is to create a version up to point 6, save it as _template or something and then create your real file name from that one (file save as) that way you can tweak the formatting after and just have to recreate the date links.
I'm also seemingly not able to get this to work with a linked data source.
Thanks. This is exactly what I need.
Unfortunately, I also had the "list disappearing" issue before I read the comments. At least I know what to do.
I can get this to work, if I use Greater than, or less then for the filter choices.
but doing this, if there is an entry for example on the 12th.
And the users select a start date of the 12th, it won't find it.
I've tried using greater than or equal too in the filter choice, but it doesn't work.
Any ideas?
I also have problems getting this to work with a linked data source. Any idea on how to fix this?
Andreas, I have the same problem, can't get it to work with linked data source :S
Please help. I got this error An error occurred processing the data view. The XslText property is empty. when I in Step 7 after I did for first Date Filter web part
Anyone got idea to solve it?
Cindy, try undoing your xsl change. you prolly have a wrong xsl tag somewhere.
Guys, since i am working with the standard MOSS version nowadays, I was forced to figure out another way of doing this. It's clean and neat and actually a lot better since you don't have to recreate the dataview everytime. If it's helpful for anyone i'll post it. Otherwise between my 3 jobs, I most likely won't if no one needs it. LOL!
@Yanling - Yes, could you please post your updated version? This is exactly what I'm looking for, but I'm forced to work with Standard MOSS also. Thanks!
Sorry for the delay: a better way of doing this:
http://yanlinglei.blogspot.com/2010/02/filter-between-two-dates-using-dataview.html
nice post. I would love to follow you on twitter.
Awesome, thank you!
Awesome, thank you!
great post!!! a++
Hello,
This is a message for the webmaster/admin here at yanlinglei.blogspot.com.
Can I use some of the information from your post above if I provide a backlink back to this site?
Thanks,
Alex
@Alex, sure.
Hi,
Nice Article.
But there is some prob in webpart connection.
in webpart connection When i select get parameters from n click next button then all the options are disabled and i am not able to connect that webpart.
el mensaje muy Гєtil
http://www.sexfg.com/
Boldy
Post a Comment