3

I've gone through some articles, knowing that I can use querystring to filter a list web part:

https://msdn.microsoft.com/en-us/library/cc751316.aspx https://stackoverflow.com/questions/24702889/sharepoint-filtering-list-with-multiple-values-of-the-same-field

Currently I have a list web part with a date type column, let's say "Created". Now I would like to filter that column by a date range (e.g. From 2016-12-02 To 2016-12-02), so the querystring that I made was: http://example.com/MySite?FilterField1=Created&FilterValue1=2016-12-02&FilterOp1=Geq&FilterField2=Created&FilterValue2=2016-12-02&FilterOp2=Leq

There are only two records in the list which is created on 1st December.However, the search result is showing all records (Expected no records will be shown).

How to fix this problem? Or should I say, I cannot apply multiple filter condition to a single column?

I thought of customizing the SelectCommand of the list view to add the condition manually, however, this lead to another issue: Sometimes the user would like to filter by the "Title" column and sometimes they just click search button. See screenshot below:

enter image description here

I searched on the web and they said CAML is unable to add condition dynamically (i.e. if "Title" textbox is empty, the list web part will be empty too).

Is there any alternative solution to both situations?

Since I'm using Sharepoint foundation, there's no "Filter web part" for me to use.

2

You can apply only one filter on the Column using Query String. To achieve this what you can do is create a Calculated Column of Type Date and say =Created.

So you will have the same date as the Created Column. Then you can filter ">" on one column and "<" on the calculated column or vice versa

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.